Email Notifications with Custom Body & Subject in Azure DevOps using Microsoft Flow

Though AzureDevOps Email notifications are great, sometimes project team members doesn’t want to get notified for each and every state change in a Bug and only a specific few want to get to notified whenever a bug is created or closed (skipping the intermediate states). And some team members ask for all the fields in the email body they want additional fields instead of the fields that were changed .

Though the 1st one is easily achievable using notification settings filter but the still the email will go out to the entire team and the second one is bit tricky, So once I again I went with a solution using Microsoft Flow.

Requirement: Send an Email notification whenever bug is closed only to QA Team

Pre-Requisites: Create a separate permission group called “QA Team” and add the QA team members to it

Steps Involved

Step 1: Create a flow having a trigger as workitem updated

Step 2: Add another step to get the workitem details as shown

Step 3: Initialize a string called “ToEmails” as shown


Step 4: Get the Team details using AzureDevOps connector as shown below

Step 5: Then Parse the json from getting the Team Details by adding a new Action called “Parse Json” and choose the content as output from “Get Team Members”

Step 6: Then add a Apply to Each action and append the email to the string variable called “ToEmails” we initialized at the start

Step 7: Then choose one of the Send Email actions from the flow (You can choose either SendGrid, Outlook,Office365 or even Gmail or any SMTP connection)

Step 8: Add the HTML template as shown..you can get it from here in case you need it (I just modified the default email we get from azuredevops and modified it by adding custom fields)

Step 9 : Add your Custom Subject and Body as shown

Step 10 : Then finally add a if condition to check if the bug is closed and then trigger the rest of the flow as shown (If the bug state is closed, then Send an Email as shown)

Step 11: As soon as the Bug is closed, you will get a Custom Email notification as shown below where the Subject & Body are fully customized

Different Uses of this technique/approach

Whatever I have demonstrated is just a sample and there are lot more ways in which the above approach could be used (These are just a few)

  1. Getting Email notifications along with screenshots/attachments for Bugs
  2. Getting the Bugs to a specific Development team based on AreaPath/Tags/Custom Field etc.,
  3. Sending Email notifications whenever a Story is ready for the Demo/Testing
  4. Build Email notifications with commits and userstories
  5. Automation Build Execution Report Email
  6. Build Deployment Emails along with Bugs resolved in the Build

There is umpteen no of ways in which the above technique can be used to improve productivity across the teams using AzureDevOps with Flow

If you have any doubts contact me @Ramanean on Twitter

You may also like...