1

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

这是我的查询。

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)

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

4

1 回答 1

0

为了将故事与 Rally 中的父关联,您需要将“父”字段的值指定为父故事的 _ref。您可以通过查询父故事或直接分配 _ref(如果您已经知道它)来执行此操作。这是一个例子:

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
于 2013-10-06T01:18:13.210 回答