HRY
HRY

Reputation: 11

Power Automate flow to update a workitem with a custom ID for particular work item type

Power Automate flow to update a workitem with a custom ID for particular work item type. E.g. we have workitem type 'Activity' and if a user creates a new workitem Activity then update the field 'custom ID' as 'Activity - 1' then the next time a user created new workitem Activity then update the field 'custom ID' as 'Activity - 2' and so on. appreciate any kind of help.

tried below flow but it gives an error and not sure how to get the serial number. enter image description here. Also I dont find the custom field 'Custom ID' in the 'update work item' action. enter image description here

new error while trying to run the flow:

enter image description here

enter image description here

Upvotes: 1

Views: 4933

Answers (1)

Ziyang Liu-MSFT
Ziyang Liu-MSFT

Reputation: 5296

To update a work item with a custom ID for particular work item type, you can refer to the followings.

Step1: Use action "When a work item is created" enter image description here

Step2: Use action "Get work item details" enter image description here

Work Item Id is get from Step1.

Step3: Use action "HTTP" enter image description here

This action uses REST API Work Items - Update to update work item field.

URL: https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=7.0

Headers: Key: Content-Type Value: application/json-patch+json

Body:

[
  {
    "op": "add",
    "path": "/fields/Custom.customID",
    "value": "Activity - 1"
  }
]

Authentication: Basic

Username: Your user name in Azure DevOps. You can check from User settings.

Password: Personal Access Token created in Azure DevOps.

Then when I create a new Activity, the custom ID will be "Activity - 1". enter image description here

Upvotes: -1

Related Questions