How to – use HTTP Action to call DataVerse / Dynamics 365 Web API in Power Automate


Let us take a simple example, to see the steps involved.

Here we will be manually triggering a flow, getting the token, and calling the WhoAmI request in Microsoft Dataverse / Dynamics 365.

This is how our final Flow looks like.

Inside the first HTTP action, we are calling OAuth 2.0 token endpoint v1. We have MyCrmApp registered in Azure AD and have generated the client secret for it.

Also we have created an Application User using the above application details and have given the appropriate security role.

Below is how our HTTP request looks like.

 

Method

POST

URI

https://login.microsoftonline.com/489f9a0f-1326-42ae-a00c-0dd3cd16e6e9/oauth2/token

Headers

 

Content-Type

application/x-www-form-urlencoded

Body

grant_type=client_credentials&

client_id=ad7a1cc4-123f-4270-9c11-29eb1686e203&

client_secret=m7.xyzsdfsdfe.jZ0odh-C-85qg70QPfnsI&

resource=https://[orgname].crm.dynamics.com/

Next, we have added the Compose action to get the token from the output of the HTTP request.

 

Inputs (Expression) = outputs(‘HTTP’).body.access_token

Next, we have added the HTTP action again to calls the WhoAmI request using the above token.

Method

GET

URI

https://trialcrm.api.crm.dynamics.com/api/data/v9.2/WhoAmI

Headers

 

Content-Type

application/json

Authorization

Bearer [Output of the previous step]

On triggering our Flow succeeds as shown below.

The output of the first HTTP request.

Compose step has the access token

And the final step has the result of the HTTP Get request to WhoAmI

The helpful post –

https://carinaclaesson.com/2019/11/24/using-power-automate-to-trigger-on-create-or-update-in-the-cds-and-make-http-requests-with-oauth-2-0-authentication/

https://sharepointmadeeasy.blogspot.com/2018/02/microsoft-flow-http-rest-api-invalid.html

Hope it helps..

Check other posts on Power Automate

Advertisements

Power Platform for Admins connector (preview) in Power Automate


The Power Platform for Admins connector (preview)

let’s us perform following Actions


The connector allows us to access the Business Applications Platform (BAP) API.

Below is the example of the Create Environment action, followed by Create CDS Database.

Here we are creating a trial environment in Asia region followed by a CDS database in it with base language – Hindi and currency code as INR

Let us run the flow and see the results

In Power Platform admin center can see the environment created along with the database specified.

All the key URL(s) for Power Platform Admin

Get all the details below –

Power Platform for Admins (Preview)

Power Apps and Power Automate Administration and Governance – Tools and Labs

Hope it helps..

Power Automate vs Azure Logic Apps


Power Automate

Azure Logic Apps

Power Automate is built on top of Azure Logic Apps
It is a SaaS service for workflow automation across several different apps and SaaS services. It is a PaaS service for workflow automation across several different apps, SaaS services, and IaaS services for enterprise integration.
For more of self-service and simple integration scenarios. For complex/advanced integration scenarios
Targeted for Business User, Citizen Developers, Developers, IT Pros. Targeted for Developers and IT Pros.
Brower based designer and mobile app UI only


In-browser as well as Visual Studio
Office 365 Service / License / Subscription Azure Service / License / Subscription
Flow specific Connectors

Power Automate Premium Connectors

Logic App-specific Connectors – SAP, IBM MQ, IoT, Liquid.

Logic Apps Connectors

Power Automate are specific to an environment There is no environment concept, each logic app is an independent entity.
Pay by run Pay by action run and by connector run.
Button flow

Create a button flow

Modern Approvals

https://nishantrana.me/2020/08/31/approvals-power-automate-dynamics-365/

Flow can be extended as Logic Apps

Export flow and deploy to Logic Apps

Power Automate is supposed to be designed and tested in a non-production environment and then promoted to the production environment. The solution makes it possible with connectors requiring reconfiguration. Connection references can be considered here https://flow.microsoft.com/en-us/blog/move-flows-across-environments-without-resetting-connections/
Logic Apps has ALM possibilities.

Automate deployment of Azure Logic Apps

Admin Experience through Power Platform Admin Center. Admin experience through Azure Portal.

How to – Use markdown to format approval emails – Power Automate and Dynamics 365


Let us update our previous flow, to use markdown to format the approval email.

Check other posts on Approvals – https://nishantrana.me/2020/08/31/approvals-power-automate-dynamics-365/

Markdown is the lightweight mark-up language for adding formatting elements to the plain text.

Refer the Markdown cheat sheet

We’d update the Details property of Start and wait for an approval action.

Below we have added some sample text that uses markdown syntax.

Below is how it renders in the outlook web access OWA.

And inside the Power Automate Approval Center.

Below we have used markdown syntax for defining the table.

Inside OWA.

Inside the Power Automate approval center.

And within the Power Automate mobile app

Kindly refer to the below table that lists down inconsistencies among different clients.

https://docs.microsoft.com/en-us/power-automate/approvals-markdown-support#client-support

Also check out –

https://www.about365.nl/2020/02/27/power-automate-approvals-markdown-or-html/

https://sharepains.com/2019/07/09/using-markdown-in-microsoft-flow-approval-actions/

Hope it helps..

Advertisements

Custom Responses in Approvals – Power Automate and Dynamics 365


Let us update our previous flow to use Approval Type – Custom Responses, using which we can define our custom response options (instead of limiting ourselves to Approve and Reject)

Check other posts on Approvals – https://nishantrana.me/2020/08/31/approvals-power-automate-dynamics-365/

Here we have updated the Start and wait for an approval action’s Approval Type from

Approve / Reject – First to respond

to

Custom Responses – Wait for one response.

We have defined below custom responses – Accept, Reject, and Need more details.

We have updated the Condition to check for Need more details

Let us save, check, and run the flow.

The approvers are presented with the custom responses

Here among the users to who the request is assigned, the flow will complete if any of the approvers responds, it will not wait for all the approvers to respond.

Now let us update it to use Custom Responses – Wait for all
responses.

Here the flow will wait for responses from all the approvers before moving to the next action.

Lastly, if we define more than 5 responses,

Outlook and OWA have a limitation of only showing the first five responses in the actionable message as shown below.

Within the Power Automate approval center and Power Automate mobile application we do not have this limitation.

Power Automate approval centre:

Power Automate mobile application:

Hope it helps..

Advertisements

Parallel Approvals – Power Automate and Dynamics 365


Let us update our previous flow to include parallel approvals.

Check other posts on Approvals – https://nishantrana.me/2020/08/31/approvals-power-automate-dynamics-365/

The difference between Approve / Reject Type – Everyone must approve and parallel approvals would be that using parallel approvals we could wait for responses for all the approvers, be it approve or reject.

In case of Everyone must approve, if any of the approvers rejects, the request is considered rejected and it will not wait for other approver’s response, and for the request to be considered approved all the approver needs to approve it.

Let us add a new action Add a parallel branch after Apply to each.

Let us keep only test user 1 in the first branch and in the other branch add a Start and wait for an approval action.

We have updated both to be approval type First to respond, set Assigned to the property to test user 1 and test user 2 for the respective branches.

And also we want to evaluate the responses from both the approvers before taking further action, so we have deleted the condition action from the first branch.

Let us add a new Condition action, with 2 AND conditions, i.e. if the first user approves and the second user rejects which corresponds to the respective Start and wait for an approval action.

Here if the condition is fulfilled we update the description of the case record.

Let us save, check, and trigger the flow.

After test user 1 has approved, we can still see the flow waiting for user 2 to respond.

The flow completes successfully after the response is received from both the approvers. Here user 2 rejects the request.

As expected, we can see the description field updated as defined in the update the record action.

Hope it helps..