本文介绍了RallyDataSource.update 不适用于作品集/功能(适用于用户故事)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我使用的 API 版本:

script type="text/javascript" src="/apps/1.33/sdk.js?apiVersion=1.43"></script>

目标是在网格中显示投资组合项目/功能以及该功能的所有子用户故事.然后根据US fields的值,更新portfolio item/feature的field的值.

我可以使用 rallydatasource.update 命令更新 UserStory 的发布字段,但相同的命令不适用于更新投资组合项目/功能的字段

以下是我尝试为 Feature 更新的字段.这些都行不通

rallyDataSource.update({_ref:ref, GroomingState: nfGroomingState},onUpdateComplete,onError);raiseDataSource.update({_ref:ref, c_GroomingState: nfGroomingState},onUpdateComplete,onError);raiseDataSource.update({_ref:ref, Ready: true},onUpdateComplete,onError);raiseDataSource.update({_ref:ref, Notes: "This is test"},onUpdateComplete,onError);raiseDataSource.update({_ref:ref, Architect: "XYZ ABC"},onUpdateComplete,onError);

这是我要为 UserStory 更新的字段.这确实有效.

rallyDataSource.update({"_ref":sRef,释放": [{参考:relRef}]},onUpdateComplete,onError);

如果我做错了什么,有人可以帮助我理解吗?v 1.43 不支持更新投资组合项目吗?

解决方案

您正在使用技巧 ?apiVersion=1.43 将 WS API 版本设置为旧版 ) 不能保证 rallyDataSource.setApiVersion("1.43"); 技巧适用于所有场景.

Here is the API verison I am using:

script type="text/javascript" src="/apps/1.33/sdk.js?apiVersion=1.43"></script>

The goal is to display a portfolio item/feature and all the child user stories of the feature in a grid. Then based on the US fields value, update the value of the field of the portfolio item/feature.

I am able to update the release field of a UserStory using rallydatasource.update command, but the same command doesn't work for updating fields of portfolio item/feature

Here are the fields I am trying to update for Feature. These do not work

rallyDataSource.update({_ref:ref, GroomingState: nfGroomingState},onUpdateComplete,onError);
rallyDataSource.update({_ref:ref, c_GroomingState: nfGroomingState},onUpdateComplete,onError);
rallyDataSource.update({_ref:ref, Ready: true},onUpdateComplete,onError);
rallyDataSource.update({_ref:ref, Notes: "This is test"},onUpdateComplete,onError);
rallyDataSource.update({_ref:ref, Architect: "XYZ ABC"},onUpdateComplete,onError);

Here are the fields I am trying to update for UserStory. This does work.

rallyDataSource.update({
  "_ref":sRef,
  "Release": [
    {
      ref:relRef
    }
  ]},
onUpdateComplete,onError);

Can someone please help me understand if there is something I am doing wrong?Is update to portfolio item not supported in v 1.43?

解决方案

You are using a trick ?apiVersion=1.43 to set the WS API version to the version the legacy AppSDK1 predates and does not support, and it works to the extent but not enough to get the updates working.

I suggest AppSDK2Also, since State of PI types is a full object (unlike State or ScheduleState of Defects or UserStories) a _ref has to be used in this code: GroomingState: nfGroomingState You may be using the reference, it was not clear from the code fragment. There is a Ruby example here that works with PI states. Rally Ruby toolkit sits on the same WS API model, so that example is not entirely irrelevant.

Here are the details of what I tried with AppSDK1 set to use version 1.43 of WS API.Regardless how I set the version either using src="/apps/1.33/sdk.js?apiVersion=1.43" or rallyDataSource.setApiVersion("1.43"); I have to use parent type:

PortfolioItem

instead of concrete PortfolioItem/Feature type when I query:

function itemQuery() {
      var queryObject = {
          key: "pi",
          //type: "PortfolioItem/Feature", //does not work
          type: "PortfolioItem",
          fetch: "FormattedID,Parent,State,Name",
           query: "(Parent.FormattedID = I8)"
       };
rallyDataSource.findAll(queryObject, populateTable);
}

This works fine, and all children of PortfolioItem/Initiative I8, which are of type PortfolioItem/Feature are returned successfully, and if all I want to do is to build a grid, it works:

function populateTable(results) {
     var tableDiv = document.getElementById('aDiv');
     for (var i=0; i < results.pi.length; i++) {
         var config = { columns:
             [{key: 'FormattedID', header: 'Formatted ID', width: 100},
         {key: 'State.Name', header: 'State', width: 100},
         ]};
        var table = new rally.sdk.ui.Table(config);
         table.addRows(results.pi);
         table.display(tableDiv);
      };

Two features are returned, one that has State already set, the other with no State:

However if I try to add the update function:

function populateTable(results) {
     var tableDiv = document.getElementById('aDiv');
     for (var i=0; i < results.pi.length; i++) {
         if(results.pi[i].State === null){
            console.log('state:',results.pi[i].State)
            rallyDataSource.update({"_ref":results.pi[i]._ref, "State": "https://rally1.rallydev.com/slm/webservice/v2.0/state/12352608621"});
        }
    }
    //...

"Requested type name "feature" is unknown error is returned:

OperationResult: ObjectErrors: Array[1]0: "Requested type name "feature" is unknown."length: 1__proto__: Array[0]Warnings: Array[1]0: "Please update your client to use the latest version of the API. You can find the latest version at https://rally1.rallydev.com/slm/doc/webservice/index.jsp?version=v2.0. No new projects should use this version of the API as it will be removed in the future."length: 1

AppSDK1 works with WS API that is no longer supported. Last supported date for 1.43 was June 20 of this year. AppSDK1 stopped at 1.32 of WS API. That is the reason for the trick to set WS API version because PortfolioItems were introduced in 1.37 of WS API. Particularly when you use features introduced after AppSDK1 was no longer updated (see WS API versioning) there is no guarantee that the rallyDataSource.setApiVersion("1.43"); trick will work in all scenarios.

这篇关于RallyDataSource.update 不适用于作品集/功能(适用于用户故事)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 06:02