AX – D365FFO – POWER AUTOMATE – TRIGGERS USING BUSINESS EVENT IN POWER AUTOMATE AND MICROSOFT DYNAMICS 365 FINANCE AND OPERATIONS

Triggers using business event in Microsoft Dynamics 365 Finance and Operations

Wondering how to quickly configure D365FO to get alerts based on activities/events and be able to make informed decisions?

If you have been using LogicApps, MS Flow, PowerApps and wondering when would triggers be made available with D365FO then from PU24 and onwards a private preview/hidden feature could be unveiled to enable trigger from D365FO.

There are multiple consumers which are supported across PU24 and PU25 and more to come. Some of known endpoint consumers include Service bus, Event grid, MS Flow, Azure blob storage, etc.

Sharing briefly how to leverage business events as a trigger from D365FO in Power Automate/MS Flow in an end to end way.

Go to D365FO-System administration – system parameters to see a new tab ‘Business events – preview’ and ENABLE it.

Image

5) Before we use any of the available triggers, need to create one or many endpoints.

6) We would use Power Automate/Microsoft Flow as our endpoint throughout this end to end demonstration for which we would need a URL from Flow to be provided in D365FO endpoint.

Image

7) We would need to create a Flow and consume this trigger using available options.

8) Let us create a new simple Flow from scratch and use a starting point as HTTP request.

Image

9) We need a JSON schema for flow request body using HTTP request.

10) Let us download one from the Business events screen in D365FO e.g. Purchase Order Confirmation.

Image

11) This schema is provided in text format and we can use free tools to covert in right JSON format.

12) One such tool is https://www.jsonschema.net where we would remove the line numbers and use the schema.

Image

13) Here is a transformed schema just in case you would like to use this example as it is

{

“definitions”: {},

“$schema”: “http://json-schema.org/draft-07/schema#“,

“$id”: “http://example.com/root.json“,

“type”: “object”,

“title”: “The Root Schema”,

“required”: [

   “EventId”,

   “EventTime”,

   “LegalEntity”,

   “MajorVersion”,

   “MinorVersion”,

   “PurchaseJournal”,

   “PurchaseOrderDate”,

   “PurchaseOrderNumber”,

   “PurchaseType”,

   “TransactionCurrencyAmount”,

   “TransactionCurrencyCode”,

   “VendorAccount”

],

“properties”: {

   “EventId”: {

     “$id”: “#/properties/EventId”,

     “type”: “string”,

     “title”: “The Eventid Schema”,

     “default”: “”,

     “examples”: [

       “”

     ],

     “pattern”: “^(.*)$”

   },

   “EventTime”: {

     “$id”: “#/properties/EventTime”,

     “type”: “string”,

     “title”: “The Eventtime Schema”,

     “default”: “”,

     “examples”: [

       “/Date(-2208988800000)/”

     ],

     “pattern”: “^(.*)$”

   },

   “LegalEntity”: {

     “$id”: “#/properties/LegalEntity”,

     “type”: “string”,

     “title”: “The Legalentity Schema”,

     “default”: “”,

     “examples”: [

       “”

     ],

     “pattern”: “^(.*)$”

   },

   “MajorVersion”: {

     “$id”: “#/properties/MajorVersion”,

     “type”: “integer”,

     “title”: “The Majorversion Schema”,

     “default”: 0,

     “examples”: [

       0

     ]

   },

   “MinorVersion”: {

     “$id”: “#/properties/MinorVersion”,

     “type”: “integer”,

     “title”: “The Minorversion Schema”,

     “default”: 0,

     “examples”: [

       0

     ]

   },

   “PurchaseJournal”: {

     “$id”: “#/properties/PurchaseJournal”,

     “type”: “string”,

     “title”: “The Purchasejournal Schema”,

     “default”: “”,

     “examples”: [

       “”

     ],

     “pattern”: “^(.*)$”

   },

   “PurchaseOrderDate”: {

     “$id”: “#/properties/PurchaseOrderDate”,

     “type”: “string”,

     “title”: “The Purchaseorderdate Schema”,

     “default”: “”,

     “examples”: [

       “/Date(-2208988800000)/”

     ],

     “pattern”: “^(.*)$”

   },

   “PurchaseOrderNumber”: {

     “$id”: “#/properties/PurchaseOrderNumber”,

     “type”: “string”,

     “title”: “The Purchaseordernumber Schema”,

     “default”: “”,

     “examples”: [

       “”

     ],

     “pattern”: “^(.*)$”

   },

   “PurchaseType”: {

     “$id”: “#/properties/PurchaseType”,

     “type”: “string”,

     “title”: “The Purchasetype Schema”,

     “default”: “”,

     “examples”: [

       “”

     ],

     “pattern”: “^(.*)$”

   },

   “TransactionCurrencyAmount”: {

     “$id”: “#/properties/TransactionCurrencyAmount”,

     “type”: “integer”,

     “title”: “The Transactioncurrencyamount Schema”,

     “default”: 0,

     “examples”: [

       0

     ]

   },

   “TransactionCurrencyCode”: {

     “$id”: “#/properties/TransactionCurrencyCode”,

     “type”: “string”,

     “title”: “The Transactioncurrencycode Schema”,

     “default”: “”,

     “examples”: [

       “”

     ],

     “pattern”: “^(.*)$”

   },

   “VendorAccount”: {

     “$id”: “#/properties/VendorAccount”,

     “type”: “string”,

     “title”: “The Vendoraccount Schema”,

     “default”: “”,

     “examples”: [

       “”

     ],

     “pattern”: “^(.*)$”

   }

}

}

14)  In Microsoft Flow, we would use the schema and create our Flow starting point using ‘HTTP request’ and with method ‘POST’.

Image

15) We can choose single path or parallel path for notifying an user. Leveraging an email notification to be sent as soon as a Purchase Order in D365FO is confirmed. This could be a mobile notification or any other out of box available Flow outputs.

16) We can choose from the list of fields mentioned in D365FO and in the JSON schema to use in notification.

Image

17) Save the Flow and copy the URL to D365FO business events endpoints screen.

18) Next activate the specific business event for ‘Purchase Order Confirmation’ from catalog.

19) Last initiate batch job for business events to keep polling for such activities in D365FO.

20) Confirm a PO and notice the results in your email via notification.

21) You can also see the flow execution history.

Image

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...