为孩子添加功能(php api) [英] add features to initiative as children (php api)
问题描述
作为子项,我将如何将功能添加到预先存在的计划中?我认为这与您在功能中更新状态的方式相同:
How would I add a feature as a children to a pre-existing initiative? I would assume it's the same way you update a state in a feature:
Connection::rally()->update('feature', feature_objectId, array('state' => $stateId));
这就是我如何将代码添加(更新子字段)子项(功能)到计划中:
Connection::rally()->update('feature', feature_objectId, array('state' => $stateId));
This is how I have the code to add (update children field) children (features) to an initiative:
Connection::rally()->update('initiative', '13298601606', array('children' => '13298601665'));
第一个对象 ID 是我想向其中添加功能的计划,第二个 ID 是作为子项添加到计划的功能.
Connection::rally()->update('initiative', '13298601606', array('children' => '13298601665'));
The first object Id is for the initiative I would like to add the features to and the second id is of the feature being added as a child to the initiative.
为什么这不起作用?有人知道如何去做吗?
Why is this not working? does someone have an idea on how to go around doing this?
推荐答案
WS API 中 Initiative 对象的子集合是只读的.
Children collection of Initiative object in WS API is read-only.
这是一个 Ruby 代码,它创建了一个新功能,并通过更新新功能的 Parent 字段将其添加到现有计划中:
Here is a Ruby code that creates a new feature and adds it to an existing initiative by updating Parent field of the new feature:
require 'rally_api'
#Setup custom app information
headers = RallyAPI::CustomHttpHeader.new()
headers.name = "My Utility: add feature to initiative"
headers.vendor = "Nick M RallyLab"
headers.version = "1.0"
# Connection to Rally
config = {:base_url => "https://rally1.rallydev.com/slm"}
config[:username] = "user@co.com"
config[:password] = "secret"
config[:workspace] = "W1"
config[:project] = "P1"
config[:headers] = headers #from RallyAPI::CustomHttpHeader.new()
@rally = RallyAPI::RallyRestJson.new(config)
obj = {}
obj["Name"] = "new feature abc456"
new_f = @rally.create("portfolioitem/feature", obj)
query = RallyAPI::RallyQuery.new()
query.type = "portfolioitem/initiative"
query.fetch = "Name,FormattedID"
query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1111" }
query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/2222" }
query.query_string = "(FormattedID = \"I1\")"
result = @rally.find(query)
initiative = result.first
field_updates={"Parent" => initiative}
new_f.update(field_updates)
这篇关于为孩子添加功能(php api)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!