Rally Software

 View Only

 Defects and HierarchicalRequirement relationship

Ryan Winkler's profile image
Ryan Winkler posted Nov 19, 2021 07:11 PM
I have a large list of Defects and need to tie each back to the appropriate associated HierarchicalRequirement. I _can_ query for all the HierarchicalRequirements, grab the ref for the Defects per HierarchicalRequirement, query for the actual Defect information for each ref, and then tie it all back in to my original list of Defects. That is an awful lot of calls to Rally, and a strain on system resources. Basically, this:
for each HierarchicalRequirement -> query for Defects via Defects._refs -> tie results into original, large list

Surely there is an easier way to acquire a Defect's associated HierarchicalRequirement, yes?
Sagi Gabay's profile image
Broadcom Employee Sagi Gabay
Hi Ryan.

Thanks for your explanation. The field that's associating a Defect to a user story is called: "Requirement". It is a 1-1 relationship of the defect to a story. You can make queries on that field and receive all defects associated with the stories that match your filter. For example:  (Requirement.FormattedID = "US101") , this will get you a list of defects associated with story that has formatted-id 101.  Another example is: (Requirement.Name contains "my story") . This will get you a list of defects associated with any story that includes a string 'my story' as part of its name.  One more example: (Requirement.Feature.PreliminaryEstimate = "L") - this will get you all defects associated with any story that belongs to any feature that has a preliminary estimate set to 'L' (Large).

The examples I had just shared include the intrinsic WSAPI filter format. 

In your question you didn't indicate how you're making your calls, whether through a script or direct http calls. 

In any event, I hope this should help. You essentially can try to make one query on the Defect object using that reference 'Requirement' field to receive the list of defects you need.

Please let us know if that helped.
Danny Saro's profile image
Broadcom Employee Danny Saro
Hi Ryan,

Looking at the API Docs I see that the "Defect" object has a "Requirement" attribute that references a HierarchicalRequirement. That might be the link you are lookuing for.