Business Central & Power Automate - Post to teams / Post invoices

To make the most of Dynamics 365 Business Central you should invest some time to understand how Power Automate works. In this example I'll start off by simply connecting BC to teams with some flows.

Teams is especially handy alongside BC as regular business users (with a standard Microsoft 365 / Office 365 license) can view BC records posted to teams. This is pretty huge, as it means you can provide visibility of records across the whole business without also needing to have everyone setup as a licensed BC user. Just turn on access for M365 users:

With Power Automate you can setup action buttons to post to teams on demand or create "when a record changes" triggers to post if particular thing happens - that you want to notify a team about.

For these flows I'm going to focus on the use of adaptive cards also; as these specifically allow any user of teams to open the BC record in teams and take advantage of the "Access with M365 license" feature. Business Central Access with Microsoft 365 licences - Business Central | Microsoft Learn

Let's look at the "push a button" flow and see a few things we could do with that.

Create a new flow, pick the Instant cloud flow; Microsoft Power Automate

The name of the flow is what will show in BC as the menu action - so name it with that in mind! Pick the 'For selected record (V3)' trigger.

On the trigger, you can control which pages in BC the action will be available on. For this example I want my new "Post to teams" button to show up in the PRODUCTION environment;  Inventory Demo company and only on Page 42 - the Sales Order card page.

The rest of this very simple flow is the 'Get adaptive card (V3)' and then the 'Post card to chat or channel' actions:

That's it - so easy! Lets test:

Logged into Business Central, on a sales order card. I have used 'personalise' mode to move the action button to my home tab. All the flows that would apply to this page show can be found under the Automate action.

After access the new action the system will check your connections used in the flow:

 And then let you know if it worked or not:

Over in teams, here is our adaptive card:

The card was generated automatically and with the details button - the record opens inside teams. Full BC users can update the record, other staff with an M365 license can view the record.

Of course to simply do what I've done here you can also use the built in share to teams button, that will ask you where to share and post the message. 

With a power automate flow however you can setup any number of other steps to embed a process in the system. You can request input from the user upon running the flow; maybe a series of questions or extra info that you then post as additional text in the teams conversation.  

An ever greater opportunity for flows and business central is around the Automated cloud flow in combination with the "When a record is modified" trigger.

In this next example I want to post a card to teams when a sales order is "fully shipped". For this you need the 'When a record is modified'. This action gets the Row ID for any records that have been changed. You can then pass this row id into the "Get record (V3)" to get all the rest of the details. 

From the full record I'm looking at the "Fully Shipped" field and using that to drive the posting of the card to teams.  

  • For the conditions, the values passed by the API are not always what you might expect. For example in BC something that's fully shipped shows "Yes", whereas in the API data this shows as "true". If your conditions are not behaving as you want - check the full output of the "Get record" from a test run to see what you need to filter on:

Lets extend this even further and automate the posting of the sales order as soon as it becomes fully shipped - yes you can do that too!

The action is carried out in the name of the flow owner:

Posted G/L Registers