我正在尝试在查询中匹配项目名称,并尝试打印与每个功能记录关联的项目名称。我知道有很多答案,但我找不到任何可以帮助我的东西。我想做这样的事情:
pi_query.type = "portfolioitem"
pi_query.fetch="Name,FormattedID,Owner,c_ScopingTeam,c_AspirationalRelease,c_AssignedProgram,Tags"
#To be configured as per requirement
pi_query.project_scope_up = false
pi_query.project_scope_down = false
pi_query.order = "FormattedID Asc"
pi_query.query_string = "(Project.Name = \"Uni - Serviceability\")"
pi_results = @rally.find(pi_query)
我正在尝试匹配项目名称,但它根本不起作用,我也尝试打印项目的名称,我尝试了Project.Name,Project.Values或只是Project。但它不起作用。我猜这是因为我的查询类型是“portfolioItem”,我无法更改我的类型,因为我正确获取所有其他属性值。 感谢。
答案 0 :(得分:0)
确保获取项目,例如:feature_query.fetch = "Name,FormattedID,Project"
这应该有效:
feature_query.query_string = "(Project.Name = \"My Project\")"
以下是按项目名称找到要素的示例。
require 'rally_api'
#Setup custom app information
headers = RallyAPI::CustomHttpHeader.new()
headers.name = "create story in one project, add it to a feature from another project"
headers.vendor = "Nick M RallyLab"
headers.version = "1.0"
# Connection to Rally
config = {:base_url => "https://rally1.rallydev.com/slm"}
config[:username] = "user@co.com"
config[:password] = "secret"
config[:workspace] = "W"
config[:project] = "Product1"
config[:headers] = headers #from RallyAPI::CustomHttpHeader.new()
@rally = RallyAPI::RallyRestJson.new(config)
obj = {}
obj["Name"] = "new story xyz123"
new_s = @rally.create("hierarchicalrequirement", obj)
query = RallyAPI::RallyQuery.new()
query.type = "portfolioitem"
query.fetch = "Name,FormattedID,Project"
query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12352608129" }
query.query_string = "(Project.Name = \"Team Group 1\")"
result = @rally.find(query)
feature = result.first
puts feature
field_updates={"PortfolioItem" => feature}
new_s.update(field_updates)