Send your Business Central approval notifications with the Power Platform

Lately I got a couple of questions how you can send your own approval notifications.
Inside Business central you got the “Workflow Notification Setup”:

In this way you can get inclient notifications or emails. But it is very hard to extend for example to post it on MS Teams or if you want per Document Type a different setup (for example on Invoices daily and Quotes on a weekly base).
With the help of the Power Platform it is easy to do. You only need to have 2 AL objects, 2 Power Automate flows and two Dataverse tables.
I know you can also use the approval workflows inside Power Automate. But this is based on the Business Central Workflows.
Example
Inside Dataverse you can setup what the users wants:

When for example the Purchase Order has “send an approval request” a Business Event will trigger a Power Automate flow:

If there is a setup and the frequency is Directly or there is no setup he will send the notification as a adaptive card directly to the user in MS Teams with a link to the approval entry inside Business Central:

Otherwise he will create an entry inside a Dataverse table:

On a daily base there will be a Power Automate flow triggered:

When this is triggered you get a nice overview of all open approval entries in MS Teams:

Extending in Business Central
In Business Central there is already an event called ‘OnBeforeCreateApprovalEntryNotification’ in the codeunit “Approval Mgmt.”. On that place you can create an integration event to a Business Event:

On this Business Event you can trigger the creation of the notification entry inside the Dataverse table or send it directly to MS Teams or another message system.
And you have to create an API page. That is all for the coding part in AL!
All the rest is inside Dataverse and Power Automate.
Code and solution
All the AL Code and the Power Automate flows and tables you can find here:
Bertverbeek4PS/NotificationEntry
Creating your own Adaptive Card? You can use this website:
Designer | Adaptive Cards
Leave a Reply