Business Events and Workflows in Dynamics 365 Finance and Operations



In today's fast-paced business environment, efficiency is paramount. Dynamics 365 Finance and Operations provides the tools necessary to automate and streamline operations, particularly through the use of workflows and business events. In this guide, we'll explore how to effectively integrate these features, helping you optimize processes and enhance your automation capabilities within Dynamics 365.

Understanding Business Events in Dynamics 365

Business events in Dynamics 365 Finance and Operations act as the crucial link between your enterprise's operations and external systems or services. These events are triggered by specific business processes, such as when an invoice is created or a purchase order is approved. By leveraging business events, organizations can extend their workflows beyond the boundaries of Dynamics 365, enabling real-time integration with external applications, services, or even other internal systems.

At its core, the business events framework is designed to facilitate seamless communication and automation. It allows your systems to listen and respond to key business activities, sending notifications, triggering workflows, or integrating with other platforms when particular actions occur. This capability not only enhances operational efficiency but also enables organizations to create more responsive, adaptable business processes.

In practice, business events can be published and consumed in various ways, whether through Microsoft Power Automate, Azure Logic Apps, or other custom applications. This flexibility makes it easier to connect Dynamics 365 with a broad array of services, from cloud-based systems to on-premises applications, ensuring that your business operations remain agile and interconnected. In this article we will use power automate as our example.

Leveraging Power Automate for Business Events Integration

To bring the power of business events to life, we will use Power Automate as our tool of choice. Power Automate, a key component of Microsoft’s Power Platform, allows users to automate workflows between various applications and services, without the need for complex coding. It provides a user-friendly interface to design, execute, and manage automated processes, making it an ideal solution for integrating Dynamics 365 business events with external systems.

Now, let’s dive into the process and see how you can set up a workflow in Power Automate to seamlessly respond to business events in Dynamics 365.

Creating a new flow in Power Automate

I will be using the purchse requisition approval flow as the example in my demonstration.

  • Sign in to the Power Automate maker portal.

  • Select the environment your Dynamics 365 Finance and Operations instance is connected with. (If you do not select the correct environment, you will not be able to select the correct parameters within the flow creator.)

  • Select the Create option from the left menu.

  • Under Start from Blank, select Automated cloud flow.

  • Please name your flow appropriately and select When a Business Event occurs as the flow’s trigger.

  • Select your environment instance, category, event name, and legel entity.

For this demo I will be using Workflow workitem as the type of business event.

  • Select the New Step button to add a new action.

  • Search for the Parse JSON data operation. We will be using this step to parse the message coming from our business event.

  • Under content, please select the body output from the When a Business Event occurs trigger.

  • Then click Generate from sample. We will be using a sample payload we download from Finance and operations to generate the schema our Parse JSON action will use to separate the various fields coming from our business event.

  • In a new tab, please proceed to your finance and operations instance.

  • Navigate to System administration > Setup > Business events > Business Events catalog

  • Under the Business event catalog tab, your busniess event. In my example it will be the Purchase requisition review (000062) - Approve purchase requisitions. This should match the business event you picked in your trigger.

  • Once you have selected your business event, click Donwnload schema on the right.

  • Once downloaded, open the file and copy it’s contents.

  • Back in power automate, paste the contents into the open Insert a sample JSON Payload window and hit done.

  • The Parse JSON action should look something like the image below.

  • Add a new step called Execute action under the Fin & Ops Apps connector. This validates whether a workflow that has the correct instance ID is running and awaiting approval.

  • Add the environment instance, and the WorkflowWorkItemInstanceID output from the Parse JSON step. For action, select WorkflowWorkItems-validate.

  • Add a new condition control step to verify the outcome of the validate action. The value output from the execute action step should be set to “is equal to” True.

outputs('Execute_action')?[body/value'] is equal to True

  • The condition control automatically generates two branches for Yes/No outcomes. If the validate step returns a No, an email should be sent to the user. This email informs the user that a new task requires their attention and prompts them to sign in to the client. To complete this step, create a new send email action within the No branch and populate the parameters with the Approver's email from the previous step, WorkflowUserEmail, along with a subject and body of your choice.

  • If the result of the validate step is Yes, you'll need to initiate a new Power Automate approval step. Within the Yes branch, add a new action titled "Start and wait for an approval" and configure the inputs as follows:

    • Approval type: Approve/reject—first to respond

    • Title: Use WorkflowWorkItemSubject output from the Business event payload

    • Assigned to: Use WorkflowUserEmail output

  • You can then populate the details section with as much relevant information as needed from the previous steps, such as WorkflowDocument, WorkflowStepInstruction and WorkflowTemplateName.

I also added LinkToWeb to make it easier in case they wanted to log into the client

  • Next, finalize the workflow approval using the Responses output of the approval step. While still in the Yes container, add a new Finance and Operations "Execute Action" step, selecting the "WorkflowWorkitem-complete" action and the WorkflowWorkitemInstanceID parameter. Complete the remaining parameters using the outputs from the approval step, ensuring that, at a minimum, the outcome section is filled with the approval Outcome and the comment section with the approver's responses and names. Since the approval step may involve multiple approvers, the response output is an array. Therefore, when you select the output Responses as the input for the comment section, Power Automate will automatically embed your action in an "Apply to each" container as shown below.

  • Click Save or Publish.

In today’s rapidly evolving business landscape, the ability to automate and optimize processes is a key differentiator for success. Dynamics 365 Finance and Operations, combined with the robust capabilities of Power Automate, provides an unparalleled platform for enhancing your enterprise’s operational efficiency. By leveraging business events, you can extend the reach of your workflows beyond the confines of your ERP system, seamlessly integrating with external applications and services in real time.

Through this guide, we’ve explored the foundational concepts of business events and demonstrated how to harness the power of Power Automate to create responsive, automated workflows that react to critical business triggers. By implementing these strategies, your organization can not only streamline operations but also become more adaptable and responsive to changing business needs.

As you continue to explore the potential of Dynamics 365 and Power Automate, remember that the true power lies in their integration. The ability to connect, automate, and optimize across your business ecosystem will position your organization to thrive in an increasingly interconnected and competitive world.

Previous
Previous

Enable Microsoft Dataverse Virtual Entities

Next
Next

AI Series: Machine Learning and Its Role in Today’s Popular AI