Azure DevOps Work Item state trigger
This time another example of a Azure DevOps trigger condition expression. In this article I will demonstrate how you can trigger a flow when a state has changed to a specific value in a recently updated Azure DevOps bug work item.
This question from kostukp96:
Can you tell me what I need to specify so that my flow is updated when the state is changed in it?
Power Users Community thread: Change trigger.
In this example we are using the When a work item is updated trigger action. After a couple of test runs with this action it was clear that the outputs included three fields which are useful for us.
In this setup those three fields are:
The goal was to create a trigger condition expression which checks if the value of the State field has changed. We will do this by comparing the System_ChangedDate and Microsoft_VSTS_Common_StateChangeDate field values. When they are the same in the last update the State has changed.
Additionaly, a check will be executed to see if the bug has changed to the ‘Approved’ value in the State field.
Both checks need to be true in order for the flow to be triggered.
In this example we are sending a Microsoft Teams private chat message to the person who registered the bug whenever a Bug work item has been approved for investigation in a specific Azure DevOps scrum project.
1. Add a When a work item is updated trigger action.
From the Azure DevOps connector. Select your organisation and your project. Select the type Bug.
2. Go to the settings of the When a work item is updated trigger action.
Add a trigger condition. The expression can be found below.
3. Add a Post message in a chat or channel action.
Select the Flow bot and Chat with Flow bot. Add a text for the message and include dynamic content fields from the Azure DevOps trigger action. In this example I only used the URL field value.
Use the CreatedBy field value from Azure DevOps for the Recipient field. You can use the expression below. In this expression a slice function is used to only retrieve the e-mail value.
That is it for the setup of this example.