Update entity from Canvas App with Power Automate

Introduction
This is third article about using Bing maps in Canvas app. In earlier articles we discussed about how we can show event organizer data in the gallery control and render them in the Bing maps. Today we are going to discuss how to update entity data from canvas app.

Canvas app with Bing Maps in Dynamics 365 CE – 1
Canvas app with Bing Maps in Dynamics 365 CE – 2

Details
We are going to discuss about how to trigger Power Automate from Canvas app to update entity record. Let’s see how we can do that

Open Canvas app that we created in earlier article, if not created yet, please follow earlier articles first. We need to edit our gallery, click on the pencil icon
part3_1
This will allow us to edit gallery template, now we need to select > control in the first row and need to add express in the OnSelect event. Delete existing express from OnSelect.
part3_2

After that we need to select Power Automate option from Action menu. Click on Create new Flow option

part3_3

It will take us to the Power Automate. Let’s first provide name of our flow as “UpdateEventOrgnizerValue” and then select Power Apps option like below
part3_4

After that click on PowerApps trigger
part3_5

Next we need to select our action, as we want to update event entity record so we will be using Update action from Common Data Service (Current environment) Connector.

part3_6

Next select event entity and under the Item Id, click on insert parameter
part3_7

Next navigate to Event organizer field and again set parameter. But keep in mind as this is a lookup field we need to first add /account() and then under the () we need to put our parameter like below
part3_9

We will be passing both of these parameters from our Canvas app. We are done with Power Automate now, save and close it, now navigate back to our Power Apps studio and select our Flow that we just created.

Now we need to set following express to call our Flow.
part3_10

Here we are getting our fist parameter using ModelDrivenFormIntegration control and passing our current event record id which we want to update. Second parameter we are getting from the gallery control, which is selected account record. Now save and publish canvas app and navigate to Dynamics 365 CE and open event entity record. When we will click on the > icon it will trigger our flow and it will set the lookup, but as flow takes some time, you may need to refresh your screen to see the changes.
part3_12

Summary
This is how we can use Power Automate to update entity information from Canvas app. Using Power Automate will take little bit time as it takes time to execute, so we may need to refresh form to see this results in next post we will see alternate way of updating entity form fields.

Hope it will help someone!
Keep learning, Keep sharing !!

Leave a Reply