Make HTTP Requests from CRM using Power-Automate
A few years ago, making an HTTP call from Dynamics CRM Services used to be very complex. The developers had to resort to C# Plugins or Workflows. In this blog, we will learn how we can consume an HTTP API by triggering an event from D365 CE (CRM) with the help of a Power-Automate (Flow).
The requirement would be – Once a user creates a D365 Account providing values to Latitude and Longitude, a Power-Automate must make a GET request to the Bing Maps API and find the time zone based on the given account Coordinates.
STEPS
- We create a new Power-Automate (Flow) that triggers on creation & update of account rows, provided the columns address1_latitude & address1_longitude are not empty. We also add a string variable called timezone_name.
2. Next, we add an HTTP action to make a GET request to the Bing Maps API. Here, the URI must be of the format:
https://dev.virtualearth.net/REST/v1/timezone/@{triggerOutputs()?['body/address1_latitude']},@{triggerOutputs()?['body/address1_longitude']}?key=<BingAccountKey> |
You can create your own Bing Maps Dev Center key by signing into the Bings portal - https://www.bingmapsportal.com/.
3. We parse the output of the above action into a JSON schema. The content would be (with the help of an expression) - @{body('HTTP_-_Get_Timezone')['resourceSets'][0]['resources'][0]}. The JSON schema is as follows:
{"type":"object","properties":{"__type":{"type":"string"},"timeZone":{"type":"object","properties":{"genericName":{"type":"string"},"abbreviation":{"type":"string"},"ianaTimeZoneId":{"type":"string"},"windowsTimeZoneId":{"type":"string"},"utcOffset":{"type":"string"},"convertedTime":{"type":"object","properties":{"localTime":{"type":"string"},"utcOffsetWithDst":{"type":"string"},"timeZoneDisplayName":{"type":"string"},"timeZoneDisplayAbbr":{"type":"string"}}}}}}} |
4. Finally, we set the value of the timezone_name variable to genericName from the output of the Parse JSON output action. Save these changes in the Power-Automate.
UNIT-TESTING
- We create a new Account with feeding values to the Coordinates (Latitude and Longitude).
- We verify that our Power-Automate triggers and finds out the time-zone based on these coordinates as expected.
CONCLUSION
Hence, we were successful in getting an API response after making an HTTP GET request in our Power-Automate (Flow), which triggers an event in D365 CE (CRM). Likewise, we can make HTTP PUT, POST, PATCH and DELETE requests as well.
Stay tuned for upcoming blogs!
Articles from Ethan Millar
View blogThis post will explain you the way to clean data and store JSON format to HBase. Hadoop architect ex ...
Hadoop integration professionals will make you learn how to explore metadata in kind of tables in Ap ...
While many Microsoft Dynamics AX technical users and developers are trying their hands on the latest ...
You may be interested in these jobs
-
Restaurant Crew Member
Found in: Appcast US A2 ECP - 4 weeks ago
Loves Travel Stops & Country Store Jasper, United StatesReq ID: 428087 · Address: 83 Carl Cannon Blvd Jasper, AL, 35501 · Benefits: * Paid Time Off * Flexible Scheduling * 401(k) - 100% match up to 5% * Medical/Dental/Vision Insurance after 30 days * Competitive Pay * Career Development · Welcome to Love's · Restaurant cashiers play a ...
-
Dedicated Delivery Driver
Found in: Lensa US P 2 C2 - 2 days ago
Kenco Group Chino, United States** Dedicated Delivery Driver** · **Job Category****:** Driver **Requisition Number****:** DEDIC005503 Showing 1 location **Job Details** · **Description** · **About the Position** · Delivery agents are responsible for delivering 1-2 pallets per stop using provided equipment. ...
-
Research Fellow
Found in: One Red Cent US C2 - 4 days ago
Biogen Cambridge, United StatesJob Description · Job DescriptionJob Description · About This Role · The computational science group at Biogen is seeking a creative and self-motivated research fellow to design, develop, and apply new machine learning algorithms for the discovery of novel AAV capsids. The Resea ...
Comments