Rally Ruby Toolkit: How to Get Url of Portfolio Item's State

Rally Ruby toolkit: how to get URL of Portfolio Item's state?

It is possible to query State, create a hash, and populate the hash with the query results, where State Name is the key and State _ref is the value:

state_results.each do |s|
s.read
state_hash[s["Name"]] = s["_ref"]
end

Then we can update a State:

features.each do |f|
field_updates={"State" => state_hash["Developing"]}
f.update(field_updates)
end

Here is a code example:

@rally = RallyAPI::RallyRestJson.new(config)

queryState = RallyAPI::RallyQuery.new()
queryState.type = :state
queryState.fetch = "true"
queryState.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/11111" }
queryState.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/22222" } #use valid OIDs
queryState.query_string = "(TypeDef.Name = \"Feature\")"

state_hash = Hash.new

state_results = @rally.find(queryState)

state_results.each do |s|
s.read
#puts "Ref: #{s["_ref"]}, Name: #{s["Name"] }, TypeDef: #{s["TypeDef"]}"
state_hash[s["Name"]] = s["_ref"]
end

query = RallyAPI::RallyQuery.new()
query.type = "portfolioitem/feature"
query.fetch = "Name,FormattedID"
query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1111" }
query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/22222" } #use valid OIDs
query.query_string = "(Name = \"my feature\")"

results = @rally.find(query)
features = [];

results.each do |f|
f.read
puts "Current state of Feature #{f["FormattedID"]}: #{f["State"].to_s}"
features << f
end

features.each do |f|
field_updates={"State" => state_hash["Developing"]}
f.update(field_updates)
puts "Feature #{f["FormattedID"]} is now in State: #{f["State"].to_s}"
end

Retrieving Portfolio Item objects using Ruby Toolkit for Rally REST API

Make sure that you use webservices API version is 1.26 or higher - Portfolio Items were first introduced into the object model starting with 1.26. I believe the Ruby REST API defaults to Webservices API 1.17 if not specified explicity. You can explicitly define it as follows:

    rally = RallyRestAPI.new(:base_url => @base_url, :username => @user_name, :password => @password, :version => 1.33)

Rally: Get from Portfolio data in a table

Samy,

Below is some code that will work.

Four things have been fixed.

  • A table can be displayed directly into a div (and you can pass in the div name)
  • You don't need an html table
  • I changed the meta data to refer to the name of your app (then we can track how many folks write apps
  • You were referencing 1.24 of our App SDK and thus our WSAPI. Portfolio Items did not exist in version 1.24. You could see that in the web service result

Mark

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Copyright (c) 2011 Rally Software Development Corp. All rights reserved -->
<html>
<head>
<title>Samys Board</title>
<meta name="Name" content="App: Samys Table" />
<meta name="Version" content="2010.4" />
<meta name="Vendor" content="Rally Software" />
<script type="text/javascript" src="/apps/1.30/sdk.js"></script>

<script type="text/javascript">

function tableExample() {

var rallyDataSource = new rally.sdk.data.RallyDataSource('__WORKSPACE_OID__', '__PROJECT_OID__', '__PROJECT_SCOPING_UP__', '__PROJECT_SCOPING_DOWN__');

modelAuswahl();

function modelAuswahl() {

var queryObj = { key: 'erg_story',
type: ["PortfolioItem"],
fetch: 'FormattedID,Name'
};

rallyDataSource.findAll(queryObj, elementShow);
}

function elementShow(results) {

var config = { columns:
[{ key: 'FormattedID', header: 'Formatted ID', width: 100 },
{ key: 'Name'}]
};

var table = new rally.sdk.ui.Table(config);

table.addRows(results.erg_story);

table.display('resultID');
//----Ende representation-----------------
};

}

rally.addOnLoad(tableExample);
</script>
</head>
<body>
<div id="resultID"></div>
</body>
</html>

Update feature object's state using Rally PHP

I was able to figure this out. Every state has a different Object ID; "In the Backlog" has an Object id of : 7177179173.

This line of code does the trick:

Connection::rally()->update('feature', '12848970281', array('state' => '7177179173'));

What it means: update the state of a feature (that has an Object ID of 12848970281) to "In the Backlog" (that has an Object ID of 7177179173)

Rally: How do I access custom created fields via the Web Services API

There is a display name and a name property when you create it. In your example my guess is fu is your display name and bar is the name.

Sample Image



Related Topics



Leave a reply



Submit