Stop Using Email for Notifications. Use Teams!

So, I’m just going to say it.

STOP USING EMAIL FOR NOTIFICATIONS. Seriously, just stop. It’s horrible.

Since I just yelled at myself too, I’ll show you how I started to use Power Automate and Adaptive Cards in Teams to send notifications to users.

We’ve created some customizations in Dynamics 365 to help us use it for simple project and task tracking (since we are using it for sales and service already). This is just using the Account and Task entity, some dashboards and a couple of new entities to track comments and time spent.

The goal is to send an immediate notification to the user assigned to a new or updated task if the priority is “High.”


The first step in Power Automate is to use the trigger When a record is created, updated or deleted in the Common Data Service (current environment). Then filter out the normal and low priority tasks. We just want to watch for new or updated records in the Tasks entity table where the Priority is “High”:

Task is created or updated

I had to go find the actual field name and do a quick Advanced Find to get the right status code.

Next, let’s add another step using the Get a record (current environment) action. This is to get some information from the Task — so we can have some details to put in our notification:

Get task details

Next step, convert the time zone. I found this out the hard way when the notification was showing a completely wrong date/time as the due date. I’m converting the Due Date of the task — from the Get task details step — to Central time because everyone in the office is all in the same time zone:

Convert time zone

It is being displayed as the full date and time — so it shows up in the notification nicely formatted.

Keeping this train moving, we need to grab the details of the the user the task is assigned to (from the Owner field in D365). Otherwise, we can’t send our notification!

Get assigned user details

This is reading the Users entity table and bringing back all the user details from the Owner (Value) field in the Get task details step. This is being done to grab the email address of the user.

Rocking and rolling along, let’s get the name of the client to add to our notification:

Get client name

This is looking up information from the Accounts entity table in D365 and only bringing back the data on the account assigned to the task (whatever was entered in the Regarding field).

Next, getting the App ID. Why would you need this? At first I didn’t know why either. Looking through the Adaptive Cards examples, a lot of them were interactive and had a button to DO something. Thinking like a user, instead of just showing a notification in Teams, why not give the user a button to actually OPEN the task right from Teams! YAY USABILITY!

To do that we need the URL of the task. Part of the URL is the “appid” parameter.

For this step I needed help and found a blog post from Sara Lagerquist (this post) about getting the App ID from a List records action in Power Automate! Thanks Sara!

Get D365 AppID

This is looking up all of the apps in the Model-driven Apps entity table in D365. Then filtering by the uniquename field of my app name called “jcma_AllFeatures” and only returning the top 1 record (there’s only going to be one).


Select the action Post your own adaptive card as the Flow bot to a user (preview). When you select this, the step will automatically be put into an Apply to each with “value” in the Select an output from the previous steps field. This is because of the previous step using the List records action.

Post your own adaptive card

The recipient is going to be the Primary Email field of the D365 user:

Teams adaptive card recipient

For the Message field, there is a ton of information and a ton of samples of Adaptive Cards here. I just took one of them (the restaurant review sample) and started modifying it to look something like this:

Adaptive Card layout for new task

Here’s what the code looks like to make this (most of this was copy/paste from the sample):

Adaptive Card Part 1

Adaptive Card Part 2

Adaptive Card Part 3

The red arrows are pointing to my modifications to make it look like the finished card.

And that’s it! When any high priority task gets created or an existing task is updated to high priority, a message is sent in Teams as the Flow user with the details:

Adaptive Card in Teams

Pretty neat!

UPDATE 11/11/2020:

Mike asked me: “The one part of this example that I don’t quite understand is where the card appears. Is it in a Chat thread from the author of the card? Is it in a specific channel (I didn’t see anything to indicate this)?”

It comes as a new Chat in Teams from the Flow user:

Flow Chat User

Flow Chat User Example

2 thoughts on “Stop Using Email for Notifications. Use Teams!”

  1. Ok so I’m onboard with your message to stop email notifications and Teams seems like a great place to send a message. The one part of this example that I don’t quite understand is where the card appears. Is it in a Chat thread from the author of the card? Is it in a specific channel (I didn’t see anything to indicate this)?
    I really like your thoroughness in explaining the steps and not making any assumptions about people’s knowledge the way a lot of bloggers do. Your writing style is easy and entertaining to follow.
    I just would have liked to see the final picture in context to the Teams application if that makes sense.

Leave a Comment

Your email address will not be published. Required fields are marked *