Understand custom pages with example playground solution

In this article I'll go through my example playground solution that you are able to download and test how Custom Pages work with model-driven application.
Understand custom pages with  example playground solution

I recently gave a presentation at the CollabDays 2024 Finland conference on ways to utilize custom page solutions as part of model-driven Power Apps applications. For this presentation, I created the playground application, which can be used to test different ways of navigating between custom pages and model-driven pages. You can also try different combinations of settings with the help of a simple user interface.

Basics of custom pages

Custom page is a native support to combine two Power Apps worlds together. You are able to navigate between views, forms and custom pages inside your model-driven application frame. It was already long time ago when Microsoft showed future roadmap where endgame was to have single type of Power Apps which just uses components from both sides, therefore custom pages are step towards that direction.

Custom pages are like canvas apps and are built like them too. Difference is that custom page needs to be used in model-driven application context. You are also able to send context parameters for custom page when it's opened so you can initialize that page.

Open as full page

Custom pages can be opened easily by putting it to model-driven navigation or opening it from custom command bar button with Navigate() function. These methods will open custom page to full page, but there are other capabilities too which, at least for now, require JavaScript to use them.

Custom Page in full screen

Open as dialogs and pane

There are other interesting ways of open custom page which I describe below.

  • Center dialog: Good for confirmation dialogs, quick creates and wizards
  • Side dialog: Same experience as with first party apps “Quick Create”
  • Side pane: Persistent page, so user is able to continue navigating through app

Open from grid view

Last but not least is the best possibility, it's possible to overwrite open action from grid views. So, you are able to us model-driven capabilities to list data from Dataverse but when you open row you open custom page rather than default form of the record. This gives a lot of new possibilities to for example create very custom read-only experiences for records and when something needs to be edited user can navigate to model-driven form to do changes.

For this you need to make changes to command bar and it can be done by using Ribbon Workbench found in XrmToolBox. There are multiple blog posts about this but here is one guide to follow:

[Step by Step] Model Driven App | Grids | Navigate to custom page on row click
By default, performing any of the following grid actions opens the table record: Double-clicking the data row, or selecting the primary column link in the row.Selecting a data row, and then pressin…

Using custom page playground

You are able to download playground solution from link below

Release Custom Page Playground (1.0.0.1) · koskiki/custompage-playground
Initial release of Custom Page Playground that was demoed on CollabDays 2024 Finland during my session “Breaking boundaries with custom pages for intuitive Power Apps model-driven UI”

After importing solution to your environment you can open model-driven application called Custom Page Playground.

Custom Page Playground application

Start to create your first playground configuration record to Playground table. Below you can see descriptions for all fields that can be defined.

Field Description Example Value
Name (Schema) Unique custom page schema name kk_playgroundpage_4a995
Title Title that can shown when opening dialog or pane Custom Dialog Title
Table Name Optionally you can define table schema name that is given for custom page kk_playground
Record Id Optionally you can define record id if you need to init page with context where it was opened [GUID]
Width Width of the page when opened as dialog or pane (500px / 50%) 800px
Height Height of the page when opened as center dialog (300px / 50%) 500px
Target Target decides where page should be opened. It can be Full Screen (1), Dialog (2) or Side Pane (3) Dialog (2)
Position If target is set as Dialog (2), you are able to define if its opened as Center (1) or Side pane (2) dialog Center (1)
Icon Icon can be only defined when opening page to side pane [WebResource]
Configuration details example

When fields are defined and record is saved you can now start to test different ways to open custom page and also navigate further through that page. Command bar includes Open Custom Page button which uses generic JavaScript with the values provided from current record.

Custom page opened from playground record
💡
Remember to test how navigation works between model-driven views, forms and custom pages. Navigation path is intact when using supported JavaScript function and PowerFx Navigate() function. You are able to jump between pages and always go backwards with browser or app back buttons. 🤯

Generic script for opening custom pages

When opening custom pages, most of the scenarios still require JavaScript function. This can be obstacle for low-code developers to use these features. Fortunately there are community superstars like Benedikt Bergmann who has created and shared generic scripts which you are able to use to make it easier for you to define JavaScript function calls. You are able to find out more about this script on link below:

Generic TS/JS to open a Custom Page » Benedikt’s Power Platform Blog
In this blog post, I will show you a reusable generic TS/JS to open a custom Page within a model-driven app.

With this script you are able to add command bar button that calls OpenCustomPage function and then define parameters to button definitions. This way you are able to easily open different kind of custom page experiences from your model-driven application.

Command bar editor - Main grid

In command bar editor

  1. Add a new button and define action as "Run JavaScript"
  2. Find that generic JavaScript file from your environment (kk_commandbar.js)
  3. Define the correct function to be called (kk_commandBar.openCustomPage)
  4. Define parameters similarly that was done in playground solution. Note, that you need to define them in order and type how they are described in JavaScript function
Example parameters

After publishing your change, you should be able to test that button 🚀😎

Summary

Custom pages are very robust way for creating totally unique experiences by combining best of both Power Apps worlds together.

  • Combine benefits of model-driven views and forms with flexibility of canvas apps UI to create best UX
  • Use generic script to open Custom Pages – don’t reinvent the wheel
  • Remember to keep navigation path intact
  • Use modern controls and Creator Kit to save time with design
  • Always make your custom pages with responsive design – use containers

Go and test how custom pages work and take them to your toolbox. Remember these possibilities next time you are designing Power Apps solution.

Final thought, instead of building a huge Canvas App, what if you split functionality to multiple Custom Pages and use model-driven app as an app frame?

Subscribe to newsletter and stay updated.

Don't miss anything. Get all the latest posts delivered straight to your inbox.
Great! Check your inbox and click the link to confirm your subscription.
Error! Please enter a valid email address!