问题
I was able to add features as children to initiatives by updating the parent field of the feature to point to the initiative (add features to initiative as children (php api))
I assumed this would be the same way to do add user stories as children to features -- by updating the field of the user story to point to its feature.
This is the code that's giving me errors:
$rally->update("story", $story['ObjectID'], array('Parent' => $feature['ObjectID']));
This is the error I'm getting:
PHP Fatal error: Uncaught exception 'RallyApiError' with message 'Could not read: Could not read referenced object 13317970914'
It seems like it's not letting me reference the feature ID..why is this happening?
回答1:
You may update PortfolioItem field on a story.
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.
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)
来源:https://stackoverflow.com/questions/18087770/add-user-stories-as-children-to-feature