2013-10-09 31 views
1

在作为工作空间管理员的Rally中,可以将值添加到用户故事(或缺陷)上的排定状态字段的下拉列表中。如何通过API查询自定义排定状态

有没有办法通过API来查询用户故事中的调度状态的下拉列表值?

我试图解决的问题是我们有自定义的报告,我们正在使用各种工作区,但是现在有一个工作区要求定义之前和接受之后的状态。我宁愿为每个工作区的每个自定义报告创建新版本来处理自定义状态,我宁愿在该工作区中查询用户故事的有效安排状态,然后在自定义报告中执行任何显示状态所需的操作。

值得一提的是,这是在v1.43中,因为这些自定义报告使用LoginKey在Rally之外运行。

回答

1

下面是一个AppSDK 1.33例如:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html> 
<head> 
    <meta name="Name" content="App Example: Attribute Values" /> 
    <title>Attribute Values Example</title> 
    <script type="text/javascript" src="https://rally1.rallydev.com/apps/1.33/sdk.js?apiVersion=1.43"></script> 
    <script type="text/javascript"> 

    function attributeQueryExample() { 

    var showAttributeValues = function(results) { 
     var aDiv = document.getElementById("aDiv"); 
     aDiv.innerHTML = '<b>attributeQueryExample</b><br>'; 
     for (var property in results) { 
     aDiv.innerHTML += "&nbsp;<b>" + property + "</b><br>"; 
     for (var i=0 ; i < results[property].length ; i++) { 
      aDiv.innerHTML += "&nbsp;&nbsp;" + results[property][i] + "<br>"; 
     } 
     } 
    }; 

    var queryConfig = []; 
    queryConfig[0] = {type: 'Hierarchical Requirement', 
      key : 'storyStates', 
      attribute: 'Schedule State' 
      }; 
     queryConfig[1] = {type: 'Defect', 
      key : 'defectStates', 
      attribute: 'Schedule State' 
      }; 

    var rallyDataSource = new rally.sdk.data.RallyDataSource('1111', '2222','false', 'false'); 
    rallyDataSource.findAll(queryConfig, showAttributeValues); 
    } 

    rally.addOnLoad(attributeQueryExample); 

    </script> 
</head> 

<body> 
    <div id="aDiv"></div> 
</body> 
</html> 

的截图:

enter image description here

+0

谢谢! - 我以为有类似State字段的内容(https://rally1.rallydev.com/slm/doc/webservice/objectModel.sp#State),但对于ScheduleState来说,它不仅显示允许的值,而且不管是之前已启用,但之后被禁用 - 但对于ScheduleState而言似乎不可能存在。 –

3

此代码将为您提供用户故事的所有可用日程安排状态数组。指定工作区OID以获取不同工作区的不同值。

Rally.data.ModelFactory.getModel({ 
    type: 'HierarchicalRequirement', 
    context: { 
     workspace: '/workspace/12345' 
    }, 
    success: function(model) { 
     var stateNames = Ext.Array.pluck(model.getField('ScheduleState').allowedValues, 'StringValue'); 
    } 
}); 
+0

嗨康纳!感谢您的快速响应,但不幸的是我没有使用SDK2.0,因为有问题的报告使用LoginKey运行在Rally之外(据我所知,这在SDK2.0中不可用)。 - 你有没有办法在SDK1.32(使用API​​ v1.43)中做到这一点? –