Microsoft Flow is a powerful tool with many different applications and possibilities. One application is to automatically create Work Items in Azure DevOps (Previously known as VSTS Online or Visual Studio Team Services Online). Agile teams who use Azure DevOps face a challenge: creating Tasks can take time away from the Dev team, depleting capacity that would be better spent developing. Microsoft Flow can help! By connecting Microsoft Flow to your Azure DevOps account and following the steps below, you can automate Task creation for “common or repetitive tasks.” Check it out…
Let's say your team is tasked with ensuring that the team follows a common process when developing, testing, and releasing work. Consider a situation where you typically have the same 9 tasks across your development teams for most but not all User Stories (more on that later). Instead of tasking the team with creating the same tasks repeatedly for each created User Story, Product Backlog Item (PBI), we can create a Flow to automate this work.
You will need Administrative privileges in order to make changes to your Project in Azure DevOps. Once you have an account with Administrative privileges navigate to your Azure DevOps instance and customize the current process for your Project.
Select the Work Item “User Story” and create a new field called Tasks Created with a Type of Date/Time. This will allow you to indicate on a User Story that the tasks were automatically created, thereby ensuring you do not create duplicate tasks for that story (more on that later).
Now that you have created that field on the User Story Work Item, navigate to Microsoft Flow.
Select +Create and select new Automated flow.
Choose trigger for Azure DevOps by searching for Azure DevOps and select When a work item is created and click Create.
In the next window, choose your organization’s Account name from the available Account Name drop down (https://AccountName.visualstudio.com). Next select the Project Name from the Project Name drop down (https://AccountName.visualstudio.com/ProjectName). Finally, select User Story for Type.
To ensure that your flow only creates tasks for new User Stories that don’t already have tasks, select Condition Control.
Within the Condition, set Tasks Created (this is the new field you created for the User Story work item in Azure DevOps) is not equal to Created Date. There are many different conditions you can add as well to ensure you are only creating tasks for certain User Stories. But for this example, we will use just the one criterion.
Next, select Add an action under the If yes section. Search for “create a work item” and select the Azure DevOps Create a work item action.
In order to automatically create tasks and connect the action to your Azure DevOps environment using the Account and Project Name from the previously complete “When a work item is created” step, select your Account and Project Name from the list of options. Next, select Work Item Type to Task. Set the title and description of your desired task along with any additional fields you might want to set. Then, expand Advanced Options and set both the Iteration Path and the Area Path. Make sure to set the Link URL to the “When a work item is created” URL and set the Link Type to Hierarchy-reverse to create the Task as a child of the User Story.
Repeat the Create a work item step for all the necessary Tasks, ensuring you fill in the necessary fields in the Advanced Options for your team. It is important as you are scrolling through the dynamic content pane that you select from “When a work item is created”, which is the User Story that triggered the flow to start. Additionally, you can set the Task Activity in the Other Fields section so you can categorize your Tasks appropriately (Development, Testing, Documentation, etc.) This will enable you to match up your team members’ capacity to work on certain tasks to their work.
Still in the Yes branch, once you’re done creating your tasks, choose “Add an action” then search for “update a work item” and select the “Update a Work Item”.
To update the User Story that triggered this flow, set the Work Item ID to the ID from “When a work item is created” dynamic content. Then in the Other Fields options, type Tasks Created (the name of the new field you created in Azure DevOps). Next, set the value to the Created Date from “When a work item is created” dynamic content. This step will prevent the flow from running again and automatically creating duplicate tasks for the User Story.
We are almost done! In the If no area, select Add an action and search for “Terminate”. Next, select Terminate and set the Status to Cancelled. Finally, save your flow and test it to make sure you do not have any errors.
So, if you don’t require all the automated tasks for every user story, no problem! Simply delete or remove any unnecessary tasks, which is a lot quicker than manually creating all the necessary tasks. You now should have automated tasks being created for your team! Remember, if you are looking to automate a workflow or process, Microsoft Flow is your go-to tool!