Dynamics 365 Finance & Operations with Power Automate

发布时间 2024-01-12 15:41:58作者: lingdanglfw

 

Hello Dynamics Community,


Update 1st December 2021 / I will really suggest to read my recent article (2 years after his one about a game changer on this topic !)

Data Event Catalog D365 F&O

 

With version 10 of Dynamics 365 for Finance & Operations, fifteen (15) application events from Procure to Pay and Quote to Cash are now available out of the box in Dynamics 365 for Finance and Operations. They promise to be a powerful addition enabling self service for certain events, and better cloud integration by triggering an integration instead of periodically checking if something had been posted.  Possible business scenarios are infinite and we will cover this with Power Automate (aka Microsoft Flow) in this article !

 

Dynamics-365-Finance-and-Operations-Business-Events-Diagram.png
  • (Purchasing) Send me a push notification to my phone when a purchase order I submitted to workflow is approved.

  • (Sales) Send me an email whenever an invoice is posted for my customer

  • (Accounting/Credit) Track all customer write-offs in an Excel file on SharePoint online

  • (Manufacturing) Set up a mobile notification when a purchase order for an upset customer is received so that you can expedite the material to the work center

  • … the flexibility is amazing especially for an ERP

 

And a lot more can be done !! Yes, we can (as a developper in X++) do some customizations and add your OWN Business Events !

I like it because it will be great for Partner to propose their own solution with more Business Events, and it will be helpful to integrate it with other platforms or other systems to send events on behalf of a trigger in the ERP. You can add your own datacontract and it will available as JSON for further actions.

All informations can be seen here


So let’s cover this article with an example.

Let’s imagine, your company in D365 FinOps has setup a purchase order workflow. They have done also an email notification. But you want maybe to get a Push Notification instead of email if the amount is very large or maybe because you have been assigned to a Workflow Work Item and you have exceeded the deadline… damned !

Go to D365 FinOps first.

Since I hate to search Menu Item, let’s write it like in Google instead :)

Capture67.PNG

You will see the Business Event Catalogs first.

Let’s pick this one for our use case of Workflow :

Captureqsdqd.PNG
Captureqsdkmqskdlmkqsklmd.PNG
 

Schema here… Download it !

At the right corner you will see the Sample Data / DataContrat of this Business Event. It will be all informations that you will have for this particular event and can be useful for your integration / notification. Like maybe getting the URL (Link to Web field) of the Purchase Order related to the Workflow so that we can add it to the Mobile Push Notification when the user will be clicking it.

Or you will have also the WorkflowDueDate that you can grab it in PowerAutomate after to do some conditional purpose based on that.



So now you have the schema of your business Event. Now go to Microsoft Power Automate portal
Create a new instant Flow.

  1. Pick this type of trigger : “When a HTTP request is received”

  2. Copy/Past your schema that you download it before in there.

  3. Add a step to send a Mobile Push Notification block

  4. Save and get the URL of your FLOW that you just create.

qsdqsdqsdq.PNG

 

Let’s go deeper here if you don’t mind :)

You can add in fact some part of your JSON to a Dynamic Content of your Mobile Push Notification in this way :

  1. Introduce a new part of your Flow by adding a “Parsing JSON” between the HTTP Request and your Push Mobile Notification

  2. Click to Generate from Sample to copy/past again the schema you have downloaded before in D365 FinOps.

  3. This will look this :

skjldjklqdkjl.PNG

After that you can add, like you want, dynamic content on your mobile notification, for this demonstration I will use the Field “Link to Web

qsdqsdqddfffffffff.PNG



Or you can add also conditional split like this way based on the Due Date Workflow :

I use a function for that with : utcNow

dlslqdlmqml.PNG


And we can do more… but it’s on your side now ! Other conditional split, other integration, calling and adding all sort of connectors that Microsoft brings with Power Automate !


Now we have finished our Flow, return to D365 FinOps.
Go the Endpoint part in the Business Event Catalog of D365 FinOps and Click “new”

Here are all endpoints available at this time :

Available-Endpoints-for-MSDyn365FO-Business-Events.png

You can have of course Microsoft Flow (aka Power Automate) or maybe calling an HTTP API or in fact add your event to an Azure Service Bus (like TOPIC that I love because you can add some business logics, filters based on your subscription and receiver of this event. Maybe you want to change somehow your JSON Datacontrat depending of the subscriber that register your topic :

azure-service-bus-brokered-messaging-5-638.jpg


But here I will jump instead with Power Automate, since we just use it before for our example…

Copy/Paste the URL of your Flow that you have created earlier (it’s in the first block of your flow “ When a HTTP Request is received”)

qdssqdsqd.PNG

Now go to the Business Catalog and Activate it !

slqdsqdsqdqsd.PNG

 

Select your endpoint “Power Automate” and your Legal Entity.

qksdkqsdqd.PNG