What would be the easiest way to get all user stories for a Portfolio Item in rally API?
-
09-12-2019 - |
Question
What would be the easiest way to get all user stories for a Portfolio Item in rally API? Right now, the API only returns the immediate children.
Similar to a previous question, is there any way to filter using the API in such a way as to get only the related User Stories?
Solution
Currently for performance reasons results from the WSAPI are are limited to one level of the hierarchy. Once you have the immediate children from the results from your first query you will have to loop over each one and issue a new query for its children (and so forth recursively until you have only leaf children).
Are you doing this in an app? It can be a little challenging to manage all the async callbacks and to stitch the data back together correctly but RallyDataSource should at least making the querying part simpler...
OTHER TIPS
I am able to get the nested US of a portfolio item using: 1.43 API version
queryFeat = "((PortfolioItemType.Ordinal = 0) and " + "(Release.Name != " + "\"" + selectedRelease + "\"))";
console.log("queryfeat",queryFeat);
queryArrayFeat[0] = {
key: CARD_TYPE,
type: 'PortfolioItem',
query: queryFeat,
fetch: 'Rank,FormattedID,Name,Release,Parent,GroomingState,LeafStoryCount,PercentDoneByStoryCount,LeafStoryPlanEstimateTotal,PercentDoneByStoryPlanEstimate,Project,Tags,ObjectID,Description,UserName,Children,Ready,Architect,SolutionTestArchitect,UserStories,Pipeline,PlanEstimate,SizeConfidence,Rank,Ready,Owner,Blocked,blockedReason,Release,Iteration,ScheduleState,ExecutionOrder,DoRCriteria,AffectsDocumentationTeam,HCSRoadmapItem,TopDownGroomAllUSCreated,State',
order: 'Rank'
};
queryArrayFeat[1] = {
key: 'users',
type: 'users',
fetch: 'UserName,ObjectID,DisplayName'
};
rallyDataSource.setApiVersion("1.43");
rallyDataSource.findAll(queryArrayFeat, displayCards);
console.log("Query Results:",queryArrayFeat);