Removing tags from work items should be straight forward using the "update a work item" operation, which lets you choose to Append, Replace, or Remove tags. However since a week or so, this functionality is broken. I've posted about it here.
How or why "premium" functions in PowerAutomate can suddenly get borked for more than a week withour fixing and what that means for your business continuity, is perhaps a discussion for another day. I've been in touch with the Azure Devops devs and it seems that the API works fine, so I've tried to create a workaround using the "send an HTTP request to Azure Devops" operation, which I'm sharing here.
The problem with HTTP requests is that all tags in a work item form a single string. You can add an extra tag easily, but you can't remove them. You can only remove the entire string, thereby removing all tags.
So the strategy is:
In this example I'm removing tags from features that I've selected via a query.
First we initiate an empty variable (TagString) that we'll use to build up a string with all the tags that shouldn't be removed.
For each feature from the query result we get the details, so we can find the tags.
Now we do another "apply to each" loop named SplitTags; for the output we choose a split function:
split(outputs('Feature_Details')?['body/fields/System_Tags'],';')
The body/fields/system_tags string take the form "tag1; tag2; tag3;" so this function splits up that string into individual tags; the subsequent logic is applied to those tags individually.
We can now use a condition (Remove unwanted tags) to filter out any tags we want removed with multiple OR-statements. (In this example, MyTag and Tag1 are removed.)
If the condition is false then the tag should not be removed, so we append that tag to the TagString variable with a ';' stuck at the end, using an "append to string variable" operation.
All we have to do now is replace the existing body/fields/system_tags string value with the TagString value, using HTTP requests:
First remove all tags from the work item, then add the ones that need to remain, using the variable. At the end, empty the variable so that's it's ready for the next work item that needs some of its tags removed.
WarrenBelz
146,653
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional