Using Dynamics 365 Webhooks as the third way to trigger Flow

Posted by

There are two connectors available in Flow to get triggers from Dynamics 365 CE once it’s integrated with Common Data Service for Apps (Spring 2018 update > V9.0.2): the socialist Dynamics 365 Standard connector and the capitalist Common Data Service Premium connector.

To get the socialist Dynamics 365 Standard connector working as trigger you need to enable Change Tracking on Entity level, and there’s no way to filter on attribute(s) to base the trigger on specific field(s) changes; it will trigger on every modification of the record. I expect this connector will be deprecated once every Dynamics 365 first party app is integrated with the Common Data Service for Apps.

The capitalist Common Data Service Premium connector is (getting) more sophisticated and is able to set the scope for the access level and attribute filtering. Very nice…. but comes with a price.

But there is The Third Way to get Flow triggered from Dynamics 365 CE, by using Webhooks.
In my imagination this was already a done deal so I would only have to type the magic keywords in the search box and the detailed instructions of how to implement this would be the final chapter in my “quest”.
But I couldn’t find any trail, and I’m the type of guy that won’t ask for directions when I’m searching for my destination (family, car, you might recognize the situation). So this feeling of excitement came over me: Am I on to something here? Well, of course I had to find out!

In version 9.0 of Dynamics 365 CE it’s possible to register webhooks by using the Plug-in Registration tool.
So I have a demo tenant with Dynamics 365 CE v9.0 to test this scenario.

First I build a flow with the following trigger: When a HTTP request is received.
When the flow is saved, the HTTP POST URL is generated by Flow and can be copied.

The URL is as follows:
https://prod-32.westus.logic.azure.com:443/workflows/guid/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=signature

I will use this URL as Endpoint URL for the webhook registration, like this:
https://prod-32.westus.logic.azure.com:443/workflows/guid/triggers/manual/paths/invoke
with HttpQueryString parameters:
api-version : 2016-06-01
sp : /triggers/manual/run
sv : 1.0
sig : signature

Next step is to register a step for the webhook. In this case for the update of the Middle Name attribute for the Contact entity.

After the registration of the webhook and the step for the webhook it’s time to test it.
When I update the middle name of a Contact record in Dynamics CE and save it,

the flow gets triggered. Yes, it works! The JSON object contains the info of the updated Contact record.

So I’ve shown that there’s the third way to trigger flow from Dynamics 365 CE, with the possibility of filtering on attribute(s).

I like to thank two imaginary friends Santa and SharePoint Wonderer whose blog posts offered me a piece of the puzzle to solve this. Cheers!

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *