Similarly to passing the current record as context to the embedded canvas app, we can pass the list of related records as context.
Let us see how it works step by step.
Open the form for customization and insert\edit an existing Sub-Grid control and select Canvas App for the Add Control option.
Select the option Web for the canvas app. Here clicking on Customize will open the PowerApps studio for creating\editing the app.
Here View Name shows All Accounts the Default View selected in the Data Source section of the Display tab of the properties dialog box.
Clicking on Customize opens the PowerApps Studio as shown below. Here ModelDrivenFormIntegration is the special control which provides us the contextual data from our form.
Click on Edit, specify the layout and select from the available fields of the entity for the layout.
Go to App Settings à Advanced Settings and turn on the “Enable app embedding user experience”
Save the app in the Cloud, this will also publish the app.
This will auto-generate the App ID and auto-fill it in the Set Properties dialog box of the Sub Grid control.
Save and publish the form.
We can see our canvas app embedded in the Unified client interface as shown below in the right.
Hope it helps..