How to create a D365FO Alert in Microsoft Teams

In this article I am going to demonstrate how you can post a teams adaptive card to a sales person whenever a sales order in Dynamics 365 Finance & Operations is delivered.


The past year I have worked a lot more with Dynamics 365 Finance & Operations. Mostly this was because I was working on integrations between this product and the Dynamics 365 Customer Engagement module.

One of the scenarios I wanted to solve was the option to trigger an automation whenever the status of a Sales Order record in Dynamics 365 Finance & Operations was set to a specific value.

Sales Order is Delivered

In this example we are using the Delivered status to trigger a Power Automate flow which posts an adaptive card in Microsoft Teams to the sales person who created the Sales Order in Dynamics 365 Finance and Operations.


Alerts as Business Events

In order to achieve this we are going to look at Business events. Business events provide a mechanism that lets external systems receive notifications from Finance and Operations applications.

Out of the box you can use applications, workflows and alerts as business event types. You can even develop your own custom business events via code. In this scenario we are going to use alerts, those are the easiest to setup.

Supported destinations

Business events can post to supported endpoints. Power Automate is one of the supported endpoints.

The Dynamics 365 for Finance & Operations connector has only one trigger action available, the When a Business Event occurs action.

Within that trigger action it is possible to select different business event categories and the related business events of those categories.

Sales Order Alert Setup

Below are a few steps to setup the whenever a Sales order record is set to the status Delivered alert in D365FO.


1. Open the All sales orders page

2. On the Action Pane, on the Options tab, in the Share group, select Create a custom alert.

3. In the Create alert rule dialog box, on the Alert me when FastTab, in the Field field, select Status. In the Event field, select is set to:. In the dropdown below it select Delivered.

4. In the same Create alert rule dialog box, on the Alert me with FastTab make sure you set the Send externally toggle button to Yes.

Be sure you make a note of your alert rule id. You will need it for the flow setup.

The flow setup

1. Add a When a Business Event occurs trigger action. Select the Alerts Category. Select the When an alert rule is triggered Business event.


2. Go to the settings. Add the following expression as a trigger condition. Make sure you replace 000073 by your alert rule id.


3. Add a Parse Json action, use the body of the trigger action for the Content field. Use the following D365FO Alert Business Event parse json schema.


4. Add a List items present in table action. Select the SalesOrderHeadersV2 Entity Name. Set the Top Count to 1. Select Yes for Cross Company and use the Filter Query below. In that query we are using the KeyValue1 field from the Parse Json action, which should contain the Sales Order Number.


5. Add another List items present in table action. Select the Workers Entity Name. Set the Top Count to 1. Select Yes for Cross Company and use the Filter Query below. In that query we are using the Personnel Number field from the previous action to identify the person who created the Sales Order.


6. Add a Post an adaptive Card to a Teams user and wait for a response action. Set the Update message to Thank you for your feedback! Set the Should update card option to Yes. And use the following expression for the Recipient field. This is using the Primary Contact Email field of the Worker record.

7. Use the following body for the adaptive card. In the card I am using the Sales Order Number, Customer and Delivery Address. Obviously you can add other fields to the card.

Happy testing!

You may also like...

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.