Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2021 Release Wave 1Discover the latest updates and new features to Dynamics 365 planned April 2021 through September 2021.
Release overview guides and videos Release Plan | Preview 2021 Release Wave 1 Timeline
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
In this blog I’m going to show how to use business events to start a Power Automate flow when a batch job finishes and notify an HTTP endpoint. The idea behind this use case is that you need to notify an external system that something has finished running (such as a data import/export job) and now you want to trigger that external system to do something (such as start an integration process from its end). This can be useful so that external systems aren’t polling your integration endpoints at fixed intervals when the data hasn’t changed.
If you are not familiar with business events, you can click here for the detailed overview. They are designed to send small payloads to signal an external process to do something. These events also contain different fields of data relevant to what the business event is intended for. For example, the event for a batch job finishing will include the batch id of the job. You can view a full catalog of the business events in System administration > Setup > Business events > Business events catalog. Developers can also extend business events for use cases where one is not already available.
Use business events with care. These are not designed to move large amounts of data or serve as an integration point. Also consider how often the event will be executing as business events and batch job processing share the same server threads.
Below, I have put together a walk through to configure the different pieces to make this scenario work. The pre-requisites are:
Here is a high-level overview of each section of this walkthrough:
Creating a Batch Job
Now we’re going to create a batch job in the DAT company to trigger a Batch job has finished business event with. We’re not concerned with what this job does, and this is only meant to be a simple job for demonstration purposes.
Creating a Power Automate Flow Next, we will create the Power Automate flow that will be initiated from the Batch job has ended business event. The flow will parse a JSON payload using a schema for the business event and use a case statement to evaluate a match on the batch job id we created. If the batch job id matches, we will initiate an HTTP POST on an endpoint.
Note: Creating Power Automate flows with a business event connector requires a premium Power Apps subscription for licensing. This licensing must also be on the same tenant that the F&O environment is hosted in for the endpoint and activated business event to automatically appear in F&O. Without it, you will still be able to build and save the flow, but it won’t activate. To work around this, you can activate a Power Apps per user plan demo. After you’ve applied a demo license, you can create a Power Apps demo environment, assign a Power Apps license to your user in the M365 Admin Center, and you should be able to activate the flow in the Power Apps demo environment. Here are the steps if you need a demo license. Skip this and continue to Step 1 of this section if you already have a premium subscription to Power Apps.
Activating the flow will automatically create the endpoint in F&O and activate the business event specified in the When a Business Event occurs block (the first block in our flow). If you can save the flow but cannot activate it, you may have to use a demo for the premium subscription or upgrade your subscription as covered at the beginning of this blog. Testing the Solution
Now it all comes together, and we will execute the batch job, generate the business event, and start the Power Automate flow. Let’s verify we can see our business event endpoint and that our business event is activated:
We made it! Thanks for sticking that out, I know it was a lot of steps. I hope this was helpful to show how you can use a batch job ending to notify an external system using business events and Power Automate.
THANK YOU for reading! Please add me to LinkedIn and I hope to hear from you soon.
Business Applications communities