Business Central & Power Automate Flows
One of my personal takeaways from Nordic Days of Knowledge 2022 is definitely the integration of Power Automate in Microsoft Dynamics 365 Business Central. Since one of the latest releases, I’m now able to run my Power Automate Flows direct with the context of an existing record. Amazing!
You might wonder, what is so special? I have such feature already for my Model Driven Apps. Furthermore, there are already Power Automate Flow triggers for the common Business Central events like: When a record is created, When a record is modified, …
But this one is a little bit special. The trigger “For a selected record” give me the freedom to invoke actions based on the current context of a customer, vendor, item, …
You see, this makes definitely sense!
In other words, I can create and run a flow with the context of my Vendor “Fabrikam, Inc.”:
For this purpose, I need to activate the new function in Business Central.
Enable the Feature
This is an easy one. I enable my Power Automate Flows direct from my Business Central Feature Management ([Alt + Q] | Feature Management):
After enabling the feature for “All Users” and re-signed in, my new menu “Automate | Power Automate” appears direct under “Actions” in Business Central.
Creating a new Flow
I have a couple of options to create a new Power Automate Flow.
First of all, I can do this direct from Business Central. I use for this the action “Create new Flow” (Actions | Automate | Power Automate | Create new Flow):
As result a new Power Automate Flow is created in my Default Environment. I do this as a User, when I want to improve my personal productivity.
The second option is just the same. I create a flow direct in my Default Environment and use the trigger “For a selected record”:
After saving my flow, a new action appears underneath Actions | Automation | Power Automate in my Business Central. This action have the name of my saved flow:
There is another way if I want to add flows in context of structured development. For that reason, I create my flow in my development environment. I do this to separate development from production.
Here is an example. I create a new unmanaged solution in my development environment in Dataverse:
I use also the new solution feature Connection References to setup my Business Central connection. In consequence, I add a new connection reference to my solution:
Now, I can add a new flow with the trigger “For a selected record”. You see, my trigger uses my connection from my solution as well:
After development, I export my unmanaged as managed solution. I do this, because I want to separate development from productions and automate my solution transport later.
Finally, I import my managed solution into my default environment. During import, I setup my included connection reference with a new connection:
Now, I check the result. My solution is imported and my Power Automate flow is activated. Well done!
Lets go to Business Central and double check. My flow is there and I can run my functionality in Dataverse:
Filtering & Additional Inputs
Another very cool feature is, I can set up some filters for my trigger. In detail, I can specify the environment, company, table or page id:
As result, the Flow is only available at the filtered environment, company, page or table. Later you’ll see there are currently some limitations. However, you see also from my example, I can combine pageID and tableID with a condition.
Another amazing possibility is to add additional input information to my trigger. I can use this information in my flow as an additional context:
As result, Business Central shows my input fields. Now I can enter the needed information, before I run my Power Automate Flow:
I love this feature!!!
Limitations
And now the downside. During testing and writing of my blogpost, I realized there are currently some some limitations. This might be, because this feature is pretty new.
I found this limitations:
- The flow must exist in the Default Environment
- You can’t use Environment Variables in the filters of “For a selected record”
Let me explain the first one. I prepared all stages (DEV / VAL / TEST / PROD) for my initial demo setup in Dataverse and Business Central.
But I realized my flows from an Dataverse environment except the Default Environment wasn’t there. I importing my solution in Dataverse VAL, TEST, PROD environment – no Flows in Business Central. 🙁
The use of environment variables as filters was the next limitation. I have added two environment variables for my trigger filters:
Additionally, I used this environment variables as filter in my Power Automate Flow trigger:
The result – my flow wasn’t presented. I figured out, environment variables are currently not supported as filters in the “For a selected record” trigger.
Both limitations are in my opinion not so critical. This is because, I know a couple of workarounds in Dataverse to solve this issue.
From Demo to a real world Use Case
Last but not least, let me share a real word with you.
This week, I was showing the new Power Automate feature in Business Central to my colleague. He said: “Cool, now I’m able to automate the creation of a Business Partners in SharePoint Contract Management, based on my Vendor information in Business Central!”. Well done!
For this purpose, he created a new Power Automate Flow “Create BP on Contract Test” from Business Central:
His flow will run on a selected record (Vendor) and uses the context of this record. Based on this information, he gets additional tables and create or update the vendor in SharePoint:
After running the flow, the vendor information are imported or updated in SharePoint Contract Management:
You might say nothing special. Well let’s point out, what he realized. With this Power Automate Flow, he has saved a lot of time that he would otherwise have wasted on manual activities.
Summary
Sometimes it’s the little things that matter. Power Automate and Business Central are proven technologies, but this little new feature changes a lot.
I have showed you how to enable and use Power Automate from Business Central. Furthermore, you have seen from a real world example, what is possible with Power Automate.
Saving a few minutes of time may not really make a difference. But in a larger context, those 5 minutes gain tremendous value when the process is performed 100 times by 1000 employees a day.