Tue, 11/24/2020 - 10:25 By Lorenz Prandini Reviewed By Lloyd Sebag

Sometimes the CDS (soon to be Microsoft Dataverse, join the confusion here: https://readyxrm.blog/2020/11/16/what-is-the-microsoft-dataverse/) endpoint doesn't offer the operation details you want to do in you Power Automate Flow. For example actions like calculate a rollup field or generate a pdf can be tricky to setup the right request body. This article show you how to use Power Automate D365 API call

For overcome this issue we want to share a simple child-flow that can be used for a custom MS Dataverse endpoint call.

Create a child flow to invoke HTTP request to D365

Our child record should be triggered manually (also includes invocation from another flow) and contain the necessary properties to dynamically create the HTTP request:

manual trigger properties

First we need to initialize the variables to authenticate with the D365 environment. In our example we use an application user. For that we need the Azure Active Directory ID (AAD ID), Client-ID and Client-Secret from an app registration. See this article.

initialize authentication variables

After we know the variable values we can get a token from D365:

aquire token from D365

After that we parse the response to JSON:

parse the response token

Now we are able to execute the request using the access_token node of our parsed JSON response. The method, URI, Query and Request Body are taken from the manual trigger of the child-flow.

execute http request to D365

Finally we return the response and status code to the calling entity:

return to calling entity

Calling a child flow for custom HTTP Request to D365

We can now use our child flow to create custom calls. In this example we generate a PDF using the Microsoft.Dynamics.CRM.documenttemplate action.

calling a childflow in Power Automate

Thanks for reading and have fun creating custom HTTP calls to D365!

Power Automate D365 API call

Add new comment

Image CAPTCHA
Enter the characters shown in the image.