使用Rally在create查询中添加父字段

使用Rally在create查询中添加父字段,rally,Rally,我试图在rally中添加一个“parent”字段,该字段由父级的格式化ID组成。父对象在Rally中预先存在。我只需要知道我应该如何添加一个用户故事与它的家长ID。我也提到了这个链接 这是我的问题 child_array["Name"] = info["Name"] child_array["Description"] = info["Description"] child_array["ScheduleState"] = info["Schedule State"] child_array["

我试图在rally中添加一个“parent”字段,该字段由父级的格式化ID组成。父对象在Rally中预先存在。我只需要知道我应该如何添加一个用户故事与它的家长ID。我也提到了这个链接

这是我的问题

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)

请分享你的任何信息。谢谢

为了将故事与Rally中的父故事相关联,您需要将“Parent”字段的值指定为父故事的_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

我可以直接将ref添加到父字段吗?例如:child_story_fields[“Parent”]=“你怎么看?我试着按你的方式做,这是我的函数,但仍然不起作用。该信息包含所有值。我得到了parent的_ref,并将其附加到child_story_字段[“parent”],如代码中所示。我还尝试了另一种方法,将拉力对象指定给父场。但两者都不起作用。你将你的值赋给一个“ParentID”字段——在Rally中没有这样的字段。该字段称为“家长”。太棒了!成功了!感谢您的帮助&很抱歉在github上发表评论。我会记住的!再次感谢!很高兴听到它起作用了。Github没有问题。Stackoverflow适用于此类问答。干杯!