且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将用户故事作为孩子添加到功能中

更新时间:2023-12-06 12:46:34

您可以更新故事的 PortfolioItem 字段.

You may update PortfolioItem field on a story.

WS API doc中,分层需求(又名故事)的父字段是预计是另一个层次要求.它不能是功能.此外,故事上的 Feature 字段是只读的,Feature 上的 UserStories 集合是只读的.这让我们可以选择更新故事中的 PortfolioItem 字段.

In WS API doc Parent field on a Hierarchical Requirement(a.k.a. story) is expected to be another Hierarchical Requirement. It cannot be a Feature. Also, Feature field on a story is read-only, and UserStories collection on Feature is read-only. That leaves us with the option to update PortfolioItem field on a story.

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

Here is a Ruby code that illustrates it:

@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)