We are using Power Automate to automate some of the regular activities in every sprint. Therefore, I want to create a flow that "As Soon as the User Story is created and matches the criteria", some of the tasks should be created and linked to the User Story as Child Items.
Moreover, I can see that there is a template already available in power automate that does creates the task's but does not link it.
Based on your description and concern, test by my side, we can use Rest API to automatically link work items. And also refer to Rest API we can set the corresponding configuration in Power Automate.
Firstly, here are the steps in Rest API:
1.POST: https://dev.azure.com/{Orgname}/_apis/wit/$batch?api-version=4.1
2.See the "Body" reference as below:
[
{
"method": "PATCH",
"uri": "/_apis/wit/workitems/{Source work item ID1}?api-version=4.1",
"headers": {
"Content-Type": "application/json-patch+json"
},
"body": [
{
"op": "add",
"path": "/relations/-",
"value": {
"rel": "System.LinkTypes.Hierarchy-Reverse",
"url": "https://dev.azure.com/{Orgname}/_apis/wit/workItems/{Target work item ID}",
"attributes": {
"comment": "Making a new link for the dependency"
}
}
}
]
},
{
"method": "PATCH",
"uri": "/_apis/wit/workitems/{Source work item ID2}?api-version=4.1",
"headers": {
"Content-Type": "application/json-patch+json"
},
"body": [
{
"op": "add",
"path": "/relations/-",
"value": {
"rel": "System.LinkTypes.Hierarchy-Reverse",
"url": "https://dev.azure.com/{Orgname}/_apis/wit/workItems/{Target work item ID}",
"attributes": {
"comment": "Making a new link for the dependency"
}
}
}
]
}
]
3.Remember to add the PAT token:
4.And the result pic: (1)
(2)In Org UI:
Secondly, see the corresponding sample setting in Power Automate:
1.After your work items created, for automatically linking the tasks to User Story.
(1).Search "http" in the Operation.
Then set the configuration in HTTP.
(2).After the setting done, "Save" first to check whether the flow can run successfully, and then select "Test" by choosing " Manually".
(3).Finally, it also works.