Replies: 3 comments
-
There are options to get direct relations and all parents for WI associated with a commit. Have you tried the following parameters?
With a template something like this, basically within the associate WI loop lookup the relations from the master WI list
If that does not work a new feature shipped today allows WIQL that can navigate the WI relationsions to be written. No such a good solution as it relies on static WIQ but maybe an option See #1277 |
Beta Was this translation helpful? Give feedback.
-
Thanks Richard
Will give it a try
From: Richard Fennell ***@***.***>
Sent: Wednesday, April 6, 2022 11:23 AM
To: rfennell/AzurePipelines ***@***.***>
Cc: Mark Anderson ***@***.***>; Author ***@***.***>
Subject: [EXTERNAL] Re: [rfennell/AzurePipelines] How do I get parent items? (Discussion #1280)
There are options to get direct relations and all parents for WI associated with a commit. Have you tried the following parameters?
Parmeter
Usage
getParentsAndChildren
Get Direct Parent and Children for associated work items, defaults to false
getAllParents
Get All Parents for associated work items, recursing back to workitems with no parents e.g. up to Epics, defaults to false
With a template something like this, basically within the associate WI loop lookup the relations from the master WI list
# Global list of WI with PRs, parents and children
{{#forEach this.workItems}}
{{#if isFirst}}### WorkItems {{/if}}
* **{{this.id}}** {{lookup this.fields 'System.Title'}}
- **WIT** {{lookup this.fields 'System.WorkItemType'}}
- **Tags** {{lookup this.fields 'System.Tags'}}
- **Assigned** {{#with (lookup this.fields 'System.AssignedTo')}} {{displayName}} {{/with}}
- **Description** {{{lookup this.fields 'System.Description'}}}
- **PRs**
{{#forEach this.relations}}
{{#if (contains this.attributes.name 'Pull Request')}}
{{#with (lookup_a_pullrequest ../../pullRequests this.url)}}
- {{this.pullRequestId}} - {{this.title}}
{{/with}}
{{/if}}
{{/forEach}}
- **Parents**
{{#forEach this.relations}}
{{#if (contains this.attributes.name 'Parent')}}
{{#with (lookup_a_work_item ../../relatedWorkItems this.url)}}
- {{this.id}} - {{lookup this.fields 'System.Title'}}
{{#forEach this.relations}}
{{#if (contains this.attributes.name 'Parent')}}
{{#with (lookup_a_work_item ../../../../relatedWorkItems this.url)}}
- {{this.id}} - {{lookup this.fields 'System.Title'}}
{{/with}}
{{/if}}
{{/forEach}}
{{/with}}
{{/if}}
{{/forEach}}
- **Children**
{{#forEach this.relations}}
{{#if (contains this.attributes.name 'Child')}}
{{#with (lookup_a_work_item ../../relatedWorkItems this.url)}}
- {{this.id}} - {{lookup this.fields 'System.Title'}}
{{/with}}
{{/if}}
{{/forEach}}
If that does not work a new feature shipped today allows WIQL that can navigate the WI relationsions to be written. No such a good solution as it relies on static WIQ but maybe an option See #1277<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frfennell%2FAzurePipelines%2Fdiscussions%2F1277&data=04%7C01%7Cmark.anderson%40gtigrows.com%7Cd9f0ce2c995445006e2008da17e9b5bc%7C080c6c8ebced4e09b5c36e55cbd80da4%7C0%7C0%7C637848589807373892%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=KyvWxb1GZpk4JeC0xFxJsdhQHrKvNzrKWb88eoBKo8Q%3D&reserved=0>
-
Reply to this email directly, view it on GitHub<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frfennell%2FAzurePipelines%2Fdiscussions%2F1280%23discussioncomment-2517454&data=04%7C01%7Cmark.anderson%40gtigrows.com%7Cd9f0ce2c995445006e2008da17e9b5bc%7C080c6c8ebced4e09b5c36e55cbd80da4%7C0%7C0%7C637848589807373892%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=p%2Bg2QoUxx2iGFiF3Bi6pZdTX5%2B2cI1rhfkyF6kXbNZE%3D&reserved=0>, or unsubscribe<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAWNWAHEKG4TCMAPUS3J5XILVDW26BANCNFSM5SWOWHCQ&data=04%7C01%7Cmark.anderson%40gtigrows.com%7Cd9f0ce2c995445006e2008da17e9b5bc%7C080c6c8ebced4e09b5c36e55cbd80da4%7C0%7C0%7C637848589807373892%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=5FSSH5y4yTLttFXSsJDgRXpjUSfwvu2YFSaxVO0XM6s%3D&reserved=0>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi Rich
Just an FYI
The code below seems to be missing a closing {{/forEach}}
Best
mark
From: Richard Fennell ***@***.***>
Sent: Wednesday, April 6, 2022 11:23 AM
To: rfennell/AzurePipelines ***@***.***>
Cc: Mark Anderson ***@***.***>; Author ***@***.***>
Subject: [EXTERNAL] Re: [rfennell/AzurePipelines] How do I get parent items? (Discussion #1280)
There are options to get direct relations and all parents for WI associated with a commit. Have you tried the following parameters?
Parmeter
Usage
getParentsAndChildren
Get Direct Parent and Children for associated work items, defaults to false
getAllParents
Get All Parents for associated work items, recursing back to workitems with no parents e.g. up to Epics, defaults to false
With a template something like this, basically within the associate WI loop lookup the relations from the master WI list
# Global list of WI with PRs, parents and children
{{#forEach this.workItems}}
{{#if isFirst}}### WorkItems {{/if}}
* **{{this.id}}** {{lookup this.fields 'System.Title'}}
- **WIT** {{lookup this.fields 'System.WorkItemType'}}
- **Tags** {{lookup this.fields 'System.Tags'}}
- **Assigned** {{#with (lookup this.fields 'System.AssignedTo')}} {{displayName}} {{/with}}
- **Description** {{{lookup this.fields 'System.Description'}}}
- **PRs**
{{#forEach this.relations}}
{{#if (contains this.attributes.name 'Pull Request')}}
{{#with (lookup_a_pullrequest ../../pullRequests this.url)}}
- {{this.pullRequestId}} - {{this.title}}
{{/with}}
{{/if}}
{{/forEach}}
- **Parents**
{{#forEach this.relations}}
{{#if (contains this.attributes.name 'Parent')}}
{{#with (lookup_a_work_item ../../relatedWorkItems this.url)}}
- {{this.id}} - {{lookup this.fields 'System.Title'}}
{{#forEach this.relations}}
{{#if (contains this.attributes.name 'Parent')}}
{{#with (lookup_a_work_item ../../../../relatedWorkItems this.url)}}
- {{this.id}} - {{lookup this.fields 'System.Title'}}
{{/with}}
{{/if}}
{{/forEach}}
{{/with}}
{{/if}}
{{/forEach}}
- **Children**
{{#forEach this.relations}}
{{#if (contains this.attributes.name 'Child')}}
{{#with (lookup_a_work_item ../../relatedWorkItems this.url)}}
- {{this.id}} - {{lookup this.fields 'System.Title'}}
{{/with}}
{{/if}}
{{/forEach}}
If that does not work a new feature shipped today allows WIQL that can navigate the WI relationsions to be written. No such a good solution as it relies on static WIQ but maybe an option See #1277<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frfennell%2FAzurePipelines%2Fdiscussions%2F1277&data=04%7C01%7Cmark.anderson%40gtigrows.com%7Cd9f0ce2c995445006e2008da17e9b5bc%7C080c6c8ebced4e09b5c36e55cbd80da4%7C0%7C0%7C637848589807373892%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=KyvWxb1GZpk4JeC0xFxJsdhQHrKvNzrKWb88eoBKo8Q%3D&reserved=0>
-
Reply to this email directly, view it on GitHub<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frfennell%2FAzurePipelines%2Fdiscussions%2F1280%23discussioncomment-2517454&data=04%7C01%7Cmark.anderson%40gtigrows.com%7Cd9f0ce2c995445006e2008da17e9b5bc%7C080c6c8ebced4e09b5c36e55cbd80da4%7C0%7C0%7C637848589807373892%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=p%2Bg2QoUxx2iGFiF3Bi6pZdTX5%2B2cI1rhfkyF6kXbNZE%3D&reserved=0>, or unsubscribe<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAWNWAHEKG4TCMAPUS3J5XILVDW26BANCNFSM5SWOWHCQ&data=04%7C01%7Cmark.anderson%40gtigrows.com%7Cd9f0ce2c995445006e2008da17e9b5bc%7C080c6c8ebced4e09b5c36e55cbd80da4%7C0%7C0%7C637848589807373892%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=5FSSH5y4yTLttFXSsJDgRXpjUSfwvu2YFSaxVO0XM6s%3D&reserved=0>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
This has been working well. We are now moving from 100% tasks to to User Stories with linked child tasks. So our devs work on and check-in tasks, but the release notes and acceptance criteria are in the Stories
Ideally, what I'd like to do is show the story (and not the child tasks) if there is a Story
If there is no parent story, show the details from the task
The stories don't appear as there are no check-ins for them
Is there a way to do this?
Thanks
Mark
Beta Was this translation helpful? Give feedback.
All reactions