Open sub-grid records in a modal (dialog) form using the new “Power Apps grid control”

Similar to how you can open records in a dialog from a sub-grid using editable grids, you can now do the same using the new “Power Apps grid control” without having to deal with the grid being editable.

Reference to the following post on CLICKING ON A SUBGRID TO OPEN A MODAL FORM IN DYNAMICS 365 from Carl de Souza to make it work on editable grids.

Here is a short video of how it works using the new “Power Apps grid control”.

pen sub-grid records in a model (dialog) form using the new “Power Apps grid control”

Configuration steps.

1. Add a sub-grid to your form.
2. Select the sub-grid and add the “Power Apps grid control” component
3. Open the form in the classic designer. Click on “Switch to classic”.

4. Double click on the sub-grid.
5. Click on “Events”.
6. Create a new Webresource with the following JavaScript snippet.

7. Under “Event Handler” select the “OnRecordSelect” event.
8. Click on “+Add”.

9. Select the JavaScript library that you create based on the code provided in step 6.
10. In Function, call the “Sdk.subgridOnRecrodSelect”, click on “Enabled” and make sur to check the “Pass execution context as first parameter.
11. Don’t forget to save and publish the changes on the form.

[Option] Additionaly you can hide parts of the header of the record you are opening in the dialog.

1. Open the form of the recod you are opening in the dialog.
2. Create a new Webresource with the following JavaScript snippet.

3. Under “Events” -> On Load –> Handlers
4. Select the webresource file that you created in step 2 and under function, type “Sdk.formOnLoadHideNavigation”.
5. Click on “Enabled” and “Pass execution context as first parameter”.