Introduction: This blog will explain how you can embed the canvas app in the model-driven app form.
We will see how to get the context of the current record of Dataverse(Common Data Service) in the Canvas App.
Follow below steps to achieve this:
- Go to make.powerapps.com
- Go to solution → Open the table → Select and open the main form on which you want to embed the canvas app. (if you are not using solutions then Go to Data → Table and open the table and select the main form)
- Select the section on the form and add a required column(field) over there.
- Go to classic form editor to do that Click on Switch to classic
5. Double click on the field.
- Go to controls and click on Add Control
- Select Canvas app control
- Click on Customize
- After Clicking on Customize it will redirect you to the PowerApps studio.
You can notice below things:
- ModelDrivenFormIntegration control in the left pane. This control is responsible for bringing contextual data from the host model-driven form to the embedded canvas app.
- Edit form is automatically added to your embedded canvas app and displays the data being passed to it from the host model-driven form via the ModelDrivenFormIntegration control.
Now you can access any column of the table in the canvas app.
For example, if you want to display the description field on the canvas app.
- ModelDrivenFormIntegration.Item.’Field Name’
To access columns of a related table you can use below expression:
LookUp(Cases, Case = ModelDrivenFormIntegration.Item.Case).Contact.'Full Name'
- Save the canvas app.
- Once you save your app go back to the form designer you will notice App Id and App name will be automatically filled.
- Save and Publish your customization.
Now you can see canvas app in your model-driven app