我之前曾问过如何创建' UserStory
'并将其与Feature
'在RallyApi here.
现在,我正在询问如何创建EpicStory
。然后,创建UserStory
并将其与EpicStory
相关联。
下面,我标记了我收到错误的位置。我不知道要设置什么参数。错误是: "无法为投资组合项设置值:无法在属性投资组合项目中使用类型UserStory"
这是我到目前为止所拥有的:
// Initialize the REST API. You can specify a web service version if needed in the constructor.
RallyRestApi restApi = GetRallyRestApi();
// Create their Json object for this Feature
DynamicJsonObject toCreate = new DynamicJsonObject();
toCreate["Name"] = FeatureToAdd.Name;
toCreate["Description"] = FeatureToAdd.Description;
// create feature - (feature is under PortfolioItem)
CreateResult createFeatureResult = restApi.Create("PortfolioItem/Feature", toCreate);
// add Epic Stories
foreach (EpicStory e in FeatureToAdd.EpicStories)
{
toCreate = new DynamicJsonObject();
toCreate["Name"] = e.Name;
toCreate["Description"] = e.Description;
toCreate["PortfolioItem"] = Ref.GetRelativeRef(createFeatureResult.Reference);
// hierarchicalrequirement = UserStory
CreateResult createEpicStoryResult = restApi.Create("hierarchicalrequirement", toCreate);
// foreach userstory create the USerStory and each subsequent Task
foreach (UserStory u in e.UserStories)
{
toCreate = new DynamicJsonObject();
toCreate["Name"] = u.Name;
toCreate["Description"] = u.Description;
toCreate["PortfolioItem"] = Ref.GetRelativeRef(createEpicStoryResult.Reference); //<-This is the problem; says "Could not set value for Portfolio Item: Cannot use type UserStory in attribute Portfolio Item"
// hierarchicalrequirement = UserStory
CreateResult createUserStoryResult = restApi.Create("hierarchicalrequirement", toCreate);
// -- add tasks for each UserStory
foreach (eBayData.Models.Task t in u.Tasks)
{
toCreate = new DynamicJsonObject();
toCreate["Name"] = t.Name;
toCreate["Description"] = t.Description;
toCreate["WorkProduct"] = Ref.GetRelativeRef(createUserStoryResult.Reference);
// task
CreateResult createUserStoryTaskResult = restApi.Create("task", toCreate);
}
}
}
答案 0 :(得分:2)
通过查看API和Rally UI,我认为您需要将问题行从toCreate["PortfolioItem"]
更改为toCreate["Parent"]
。