Are you tired of creating multiple duplicate tasks on a user story in Azure DevOps? There is a way to easy that process – by using Microsoft Flow.

Let’s take an example where we want to create tasks on some user stories which may need testing. We have determined 3 common tasks related to testing: “Create Test case”, “Review Test case”, “Execute Test case”. We would like to automate the creation of these tasks on the user story that may need testing.

Changes to Azure DevOps

Before we start with MS Flow, we will need to make some changes to the corresponding process in Azure DevOps. We will need a toggle control to determine if we need a testing task on that user story or not. Also, we will need another toggle control that will determine if the testing tasks were created or not.

To modify the process you will need to be “admin” on that particular process.

  1. From the DevOps homepage click on “Organization settings”
  2. Under “Board” you will find “Process”; click on it
  3. Select the process you want to modify
  4. Select “User Story”
  5. Create a new field (in my case I named it as – Needs Testing Tasks)
    • Choose type = Boolean
    • Under layout, determine where on the page should it get displayed (you can create your own group)
  6. Create another field of type boolean named “Testing Tasks Created” (this field need not be on your page)

You can see it below.

UserStory-AzureDevOps

 

Create Flow

  1. Login to your Microsoft Flow
  2. Go to “My Flow” section on the left hand navigation panel
  3. Click on “New” button on the top of the ribbon
    • Select “Create from blank”
  4. Now search for “Azure DevOps” connection
  5. Search for trigger “When a work item is created”

Note: we would need two MS Flow; one for create and another for update

The overall Flow for “Work Item Create” would look like the image below:

WorkItemCreate-Flow

Let’s take a deep dive into each of those tasks.

Flow for work item created

The following images will guide you to show what to enter in each of the tasks.

 

Flow for work item updated

This one is similar to the create except the condition gets little complicated. In MS Flow you cannot trigger it only when certain fields are updated but rather it gets triggered every time the item is updated. So you would want to put checks in place to avoid running your logic multiple times. So, pay attention to the condition block.

Under condition, click “Edit in advance mode”. The below is the condition you will need to use in the advance mode.

@and(equals(triggerBody()?['Fields']?['Custom_NeedsTestingTasks'], true), equals(triggerBody()?['Fields']?['Custom_TestingTasksCreated'], false))

 

Overall flow would be as follows:

Update-Task-Overall

In action

InAction

 

Leave a comment if you have any questions.

14 comments

  1. Thanks Danish for sharing the beautiful article which really helps to fulfill my needs. I have one doubt in trigger interval in MS Flow. in what interval the trigger will be triggered – the flow I created is used to trigger half an hour and i dont see option to change interval time. I wanted child tasks should be created once after the parent feature/bug/tasks created. Kindly throw some lights on that, thanks in advance!

    Like

    1. Hi meyyazhagan, not sure I understand you completely but I’ll still try to answer your question. If you have used Recurrence trigger; you may observe in my blog I have not used a Recurrence trigger but instead I have used an event based trigger (two flows in this case) – “when a work item is created” & “when work item is updated”. So as soon as any work item gets created or updated should invoke the Flow.
      Also note that if you are using “Free Pricing Plan” for Flow each flow execution might be queued up for 15 minutes. You can read more about pricing here –> https://bit.ly/2uCA7vU

      Thank you

      Like

      1. Thanks Danish! I got the clear picture now – based on license, the flow execution time is changing.

        Like

  2. Hi Danish,

    Great article, and it definitely inspired me. The problem I’m having is that the tasks get added under eachother:
    TASK1
    |–>TASK2
    |——>TASK3

    Would you be able to make a quick screen cast/video on your exact execution? It would be very helpful 🙂

    Like

    1. I’ll try to do that soon. But in meantime make sure when you use dynamic values for example “Area Path” there could be multiple “Area Path” depending on the actions you have added on top of the action you are trying to configure. Please see the screenshot here – http://bit.ly/2Mt0G2t

      Like

    1. Make sure when you use dynamic values you select a proper Value from appropriate action; for example there could be multiple “Area Path” depending on the actions you have added on top of the action you are trying to configure. Please see the screenshot here – http://bit.ly/2Mt0G2t

      Like

  3. Hi Danish, is it possible to add url but as a hyperlink not text to the original work item in to the description of of a Task?

    Like

  4. Hi Danish,

    Is it mandatory to have licence for this Automate task creation on User Story in Azure DevOps using Flow .

    Because i have implemented exactly same as show above ,but i am not able to see the child workitems created.

    Like

  5. Hi Danish,

    Is it mandatory to get license for Automate task creation on User Story in Azure DevOps using Flow.

    Because i have implemented exactly same as show above ,but when i create a workitem and refresh, no child workitems are created.

    Please help me in this…

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: