Steven
Steven

Reputation: 27

Query to use when I know a Defect and want to search if a UserStory associated with it

I am writing in Java and have already retrieved a JsonArray of Defect items from Rally. Now I want to be able to get only those User Stories that have one of the Defects I got associated with them. I have been unable to come up with a good query to do this, and currently I am getting all the User Stories and then looking through their Defects field to see if one of the defects I had is a member.

Can anyone suggest a query that would allow me to directly get the story that goes with a defect? Thanks.

Upvotes: 1

Views: 220

Answers (1)

Charles Ferentchak
Charles Ferentchak

Reputation: 1237

Your best bet is to specify a fetch that will pull the fields you need from the story and attach them to the defect.

fetch=Requirement,Name,Iteration,ScheduleState

That would hydrate all of those fields on the story (Requirement) as well as the Defect.

{
    Defect: {
        _ref: "https://rally1.rallydev.com/slm/webservice/x/defect/5678.js",
        Name: "Sad Pandas",
        Iteration: null,
        Requirement: {
            _ref: "https://rally1.rallydev.com/slm/webservice/x/hierarchicalrequirement/1234.js",
            _refObjectName: "Pandas",
            Name: "Pandas",
            Iteration: null,
            ScheduleState: "In-Progress",
            Blocked: false,
            _type: "HierarchicalRequirement"
        },
        ScheduleState: "Idea",
        Blocked: false,
        Errors: [ ],
        Warnings: [ ]
    }
}

Upvotes: 1

Related Questions