This blog will discuss new component added to Power Apps. It is about the “Settings” component. Indeed, this component allows adding a configuration layer for a model-driven application. This allows to easily activate or deactivate a feature for a model-driven app.
For more information on this component, I invite you to read this excellent blog from Power Apps team
Enable app makers to transform a classic model-driven app into a multi-session one using the settings components. You can check out the demo at the end of the blog before continuing reading.
Please note that this blog is to demonstrate how one could use the new settings component. Using an MDA app in Multi-session mode is not yet supported.
Henry Jammes: “One I would add here is that the NavigationType of a model-driven app isn’t a documented property, so transforming a regular, single-session, model-driven app into a mutli-session one isn’t supported.
I would recommend using the Customer Service Workspace or Omnichannel for Customer Service apps for this.”
Step 1: Create the Setting Definition
First, create a solution through make.preview.powerapps.com. Yes, we will implement everything on the preview version of PowerApps. Then, create a new setting definition. In my case I named it “Enable Multi-Session Feature” and applied the following values:
Step 2: Implement the logic
Let’s go back to the initial needs. The goal is to enable multi-session behavior for a model-driven app.
Indeed, A Model-driven app is defined by a row of the Dataverse table “AppModule”. This table has the column “NavigationType” of type Choice has two values: SingleSession and Multi-Session.
We will use this column to transform our MDA! To implement the logic, I used Power Automate Cloud Flow.
We will now look in detail at each step of the flow. We start with the trigger:
The flow is triggered when a row in the appsetting aka Model-Driven App Setting table is created or modified.
This concerns only the rows associated with setting “EnableMultiSessionFeature”. It can be setup with the following expression in the trigger conditions:
After triggering the flow, I noticed that the value column does not reflect the value updated from the solution:
The second step of the flow allows to publish the app:
The third step retrieves the actual value of the value column. This will allow to decide whether or not to activate the multi-session navigation:
The other part of the flow is simple. We only need to update the row corresponding to the model driven app. Below, the action updates the “Navigation Type” column with the value “Multi session”:
The last step allows publishing the app to activate the new settings:
Step 3: Apply the setting to the MDA
First, we need to add the app to our solution. Then click on the parameter definition created in step 1. Now, we can apply this setting to our MDA.
After saving, the cloud flow is executed:
After a successful execution, the app is turned into a multi-session MDA: