1

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

HRY
  • 11
  • 3
  • According to the error message, it is because the typeName is missing when you save, you need to check where the typeName is missing. According to your description, "custom ID" is a custom field. You can check whether you can assign a value to the custom ID in **Other Fields** after filling in the Work item type and other information. – Ziyang Liu-MSFT Nov 16 '22 at 08:05
  • Hello @ZiyangLiu-MSFT, thank you for your response, it helped. :) but I get this error now while trying to run the flow. Error " InvalidTemplate. Unable to process template language expressions in action 'Update_a_work_item' inputs at line '0' and column '0': 'Unable to evaluate template language expression '@triggerOutputs()?['body/fields/Custom_CustomID']' as JSON property name: the expression value of type 'Null' could not be used as property name.'." Have attached screenshots above for your reference. – HRY Nov 17 '22 at 04:36
  • hi, have you tried to use action "HTTP" to update your custom field? If you have any question, please let me know. If it's helpful for you, to let others who have the similar question with you know this answer more clearly, it's suggested that you accept my answer below according to [How does accepting an answer work](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235). Thanks! – Ziyang Liu-MSFT Nov 29 '22 at 07:58

1 Answers1

0

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

Ziyang Liu-MSFT
  • 469
  • 3
  • 6