1

作为儿童,我将如何将功能添加到预先存在的计划中?我认为这与您更新功能中的状态的方式相同:

Connection::rally()->update('feature', feature_objectId, array('state' => $stateId)); 这就是我将代码添加(更新子字段)子(功能)到倡议的方式:

Connection::rally()->update('initiative', '13298601606', array('children' => '13298601665')); 第一个对象 ID 用于我想向其中添加功能的计划,第二个对象 ID 是作为子项添加到该计划的功能。

为什么这不起作用?有人知道如何去做这个吗?

4

1 回答 1

1

WS API 中 Initiative 对象的 Children 集合是只读的。

这是一个 Ruby 代码,它创建一个新功能并通过更新新功能的 Parent 字段将其添加到现有计划中:

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)
于 2013-08-05T20:25:28.800 回答