Tuesday, 7 September 2021

Creating custom pages as contextual modal dialogs for model driven app entity records in PowerApps

This article explains an approach to build custom pages as contextual model dialogs, integrated to the command bar controls in PowerApps. 

In the previous articles, 

The solution, model driven app and a custom landing page for model driven app was created and demonstrated in the previous article. As a continuation from the previous articles, we will take dealership scenario for the model dialog demonstration in this article. The scenario considered here is to send a task to the dealer from the main grid view in model driven app, without navigating to the entity record form or associated views. This provides flexibility to send out quick actions/tasks for the business users, assuming this feature is most used actions in the business.

Building custom page for model dialog

Creating canvas app like custom page might be familiar for you. This can be done from the solutions on PowerApps https://make.preview.powerapps.com, create a new custom page by clicking on New -> App -> Page.

The following snapshot shows one simple view created to show the selected dealer and option to send out the quick actions/tasks to the user (entity record) in model driven app.

PowerApps custom page for dialog view in model driven app

The app is configured with the following.

  • The app onStart is configured to pick the records passed from the PowerApps model driven app entity grid view. 
    • Set(RecordItem, If(!IsBlank(Param("recordId")), LookUp(Dealers, Dealers = GUID(Param("recordId")))))
  • For saving/sending the activity to the dealer (contacts entity), the onSelect property needs to be configured as shown below. 
    • Patch(Tasks,Defaults(Tasks),{Subject:TextBox1.Value,Regarding:RecordItem})

Save and publish. The next step is to integrate the page with the model driven app.