添加用户故事作为功能的子项

时间:2013-08-06 18:28:35

标签: php rally

我能够通过更新功能的父字段以指向主动性(add features to initiative as children (php api)

,将功能作为子项添加到计划中

我认为这与将用户故事作为子项添加到功能中的方式相同 - 通过更新用户故事的字段以指向其功能。

这是给我错误的代码:

$rally->update("story", $story['ObjectID'], array('Parent' => $feature['ObjectID']));

这是我得到的错误:

PHP Fatal error: Uncaught exception 'RallyApiError' with message 'Could not read: Could not read referenced object 13317970914'

好像不让我参考功能ID ..为什么会发生这种情况?

1 个答案:

答案 0 :(得分:1)

您可以更新故事中的PortfolioItem字段。

WS API doc Hierarchical Requirement(a.k.a。story)中的Parent字段应该是另一个Hierarchical Requirement。它不能是一个特征。 此外,故事中的功能字段是只读的,功能上的UserStories集合是只读的。这使我们可以选择更新故事中的PortfolioItem字段。

这是一个说明它的Ruby代码:

@rally = RallyAPI::RallyRestJson.new(config)

obj = {}
obj["Name"] = "new story efd"
new_s = @rally.create("hierarchicalrequirement", obj)

query = RallyAPI::RallyQuery.new()
query.type = "portfolioitem"
query.fetch = "Name,FormattedID"
query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/11111" } 
query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/2222" }
query.query_string = "(FormattedID = \"F22\")"

result = @rally.find(query)
feature = result.first

field_updates={"PortfolioItem" => feature}
new_s.update(field_updates)