【问题标题】:How to Query for Custom Schedule States through the API如何通过 API 查询自定义计划状态
【发布时间】:2013-10-09 00:08:28
【问题描述】:

在作为工作区管理员的 Rally 中,您可以将值添加到用户故事(或缺陷)的计划状态字段的下拉列表中。

有没有一种方法可以通过 API 查询用户故事中日程安排状态的下拉列表值?

我要解决的问题是,我们有在各种工作区上使用的自定义报告,但是现在希望其中一个工作区具有定义之前和接受之后的状态。与其为每个工作区构建每个自定义报告的新版本来处理自定义状态,我更愿意在该工作区中查询用户故事的有效计划状态,然后做任何需要做的事情来在自定义报告中显示状态。

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

【问题讨论】:

    标签: rally


    【解决方案1】:

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

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

    【讨论】:

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

    这是一个 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>
    

    截图:

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-19
    • 1970-01-01
    • 2020-06-24
    • 2021-06-13
    • 1970-01-01
    • 2020-06-07
    相关资源
    最近更新 更多