Mr Giggles
Mr Giggles

Reputation: 2104

how to get the index/ order of a defect in the Backlog, Rally Rest API C#

Task: List all defects in the backlog of a project by their rank/index.

Here is my code:

var myRequest = new Request()
    {
        ArtifactName = "defect",
        Limit = 2000,
        Query = new Query("Project.OID", Query.Operator.Equals, MyDefectProjectOID),
        Fetch = new List<string>() { "true" }
    };


    QueryResult queryMyResult = api.Query(myRequest);

Question:

1) How do I get the result set back in the order my users have organised them in Rally.

2) Is there a value on the defect item that tells me the rank/index (for example the Task item has a TaskIndex property)

Upvotes: 1

Views: 180

Answers (1)

Kyle Morse
Kyle Morse

Reputation: 8400

1) Order by the DragAndDropRank field, ASC.

2) As long as you fetch DragAndDropRank as well that's your rank value. It's encoded as a string which is sortable in client code. The overall numeric index will be its index in your result set.

Another quick note- rather than specifying a query on Project.ObjectID to control scoping, you can just set the Project, ProjectScopeUp and ProjectScopeDown values:

Project = "/project/" + MyDefectProjectOID,
ProjectScopeUp = false,
ProjectScopeDown = false

Upvotes: 1

Related Questions