首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用Rally在create query中添加父字段

使用Rally在create query中添加父字段
EN

Stack Overflow用户
提问于 2013-10-06 08:29:22
回答 1查看 377关注 0票数 1

我正在尝试添加一个"parent“字段,它由rally中的parent格式化ID组成。父级在Rally中预先存在。我只需要知道如何添加一个带有父ID的用户故事。我还引用了这个链接https://github.com/RallyTools/RallyRestToolkitForRuby/tree/master/examples

这是我的问题。

代码语言:javascript
运行
复制
child_array["Name"] = info["Name"]
child_array["Description"] = info["Description"]
child_array["ScheduleState"] = info["Schedule State"]
child_array["ParentID"] = info["Parent"]
puts "Child array parent #{child_array["ParentID"]}" #this correctly prints parentID

create_story = @rally.create("hierarchicalrequirement",child_array)

请分享您所拥有的任何信息。谢谢!

EN

回答 1

Stack Overflow用户

发布于 2013-10-06 09:18:13

为了将故事关联到Rally中的父级,您需要将" Parent“字段的值指定为父Story的_ref。您可以通过查询父故事或直接分配_ref (如果您已经知道)来完成此操作。下面是一个例子:

代码语言:javascript
运行
复制
parent_formatted_id = "US43"
parent_story_query = RallyAPI::RallyQuery.new()

parent_story_query.query_string        = "(FormattedID = #{parent_formatted_id})"
parent_story_query.type                = "hierarchicalrequirement"
parent_story_query.fetch               = "ObjectID,FormattedID,Name"
parent_story_query.project_scope_up    = false
parent_story_query.project_scope_down  = true
parent_story_query.order               = "FormattedID Asc"

parent_story_results = @rally.find(parent_story_query)
if parent_story_results.total_result_count > 0 then
    parent_story = parent_story_results.first

    child_story_fields = {}
    child_story_fields["Name"] = "Sample Child Story"
    child_story_fields["Parent"] = parent_story
    # The following would also work, if you know the ref of the parent story
    # child_story_fields["Parent"] = "/hierarchicalrequirement/12345678910"

    new_child_story = @rally.create("hierarchicalrequirement", child_story_fields)
    new_child_story.read
    puts "Created New Child Story: #{new_child_story.FormattedID}; Parented to --> #{parent_story.FormattedID}"
end
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19204117

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档