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.
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 an earlier article, if not created yet, please follow earlier articles first. We need to edit our gallery, click on the pencil icon
 
 
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.
 
 
After that we need to select Power Automate option from Action menu. Click on Create new Flow option
 
 
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
 
 
After that click on PowerApps trigger
 
 
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.
 
 
Next select event entity and under the Item Id, click on insert parameter
 
 
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
 
 
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.
 
 
Here we are getting our first parameter using ModelDrivenFormIntegration control and passing our current event record id which we want to update. We are getting the second parameter from the gallery control, which is the 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.
 
 
Hope it will help someone!

Keep learning, keep sharing !!