Embed Canvas App in Model-driven App form

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:

  1. Go to make.powerapps.com
  2. 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)
  1. Select the section on the form and add a required column(field) over there.

NOTE: Always use a required column that is guaranteed to have a value. If your column does not have a value, your embedded canvas app will not refresh in response to any change in data on the model-driven form.

  1. 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
  1. 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’
ModelDrivenFormIntegration.Item.Description

To access columns of a related table you can use below expression:

LookUp(Cases, Case = ModelDrivenFormIntegration.Item.Case).Contact.'Full Name'
  1. Save the canvas app.
  1. Once you save your app go back to the form designer you will notice App Id and App name will be automatically filled.
  1. Save and Publish your customization.

Now you can see canvas app in your model-driven app

Leave a Reply

Your email address will not be published. Required fields are marked *