Transform your Model-driven app to a multi-session app using settings solution component

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

Scenario:

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:

@endsWith(triggerOutputs()?['body/uniquename'],'EnableMultiSessionFeature')

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:

DEMO:

10 thoughts on “Transform your Model-driven app to a multi-session app using settings solution component

    1. 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.

      Liked by 2 people

  1. Hi Mehdi, thanks for sharing this article. I tried to follow your steps but at the and when I try to change the value of the Settings using the PowerApps studio I receive this error:
    GraphQL error: {« httpStatusCode »:404, »data »:{« error »:{« code »: »0x80040217″, »message »: »appsetting With Id = de26b881-f65b-ec11-8f8f-000d3ab5a3fe Does Not Exist », »@Microsoft.PowerApps.CDS.HelpLink »: »http://go.microsoft.com/fwlink/?LinkID=398563&error=Microsoft.Crm.CrmException%3a80040217&client=platform », »@Microsoft.PowerApps.CDS.TraceText »: »[Microsoft.Dynamics.AppModule.Plugins: Microsoft.Dynamics.AppModule.Plugins.SaveSettingValue]\r\n[772d7126-3864-43e7-bf33-8a8d046024d8: Microsoft.Dynamics.AppModule.Plugins.SaveSettingValue: SaveSettingValue SDK Messsage]\r\n\r\n\t[Microsoft.Crm.ObjectModel: Microsoft.Crm.ObjectModel.CallbackRegistationExpanderPlugin]\r\n\t[dfd64276-b333-484b-973e-c0471fa8f661: Callback Registration Expander]\r\n\t », »@Microsoft.PowerApps.CDS.InnerError.Message »: »appsetting With Id = de26b881-f65b-ec11-8f8f-000d3ab5a3fe Does Not Exist »}}}
    It seems that the setting has not been created.

    Like

    1. I’ve also faced this issue. I have managed to resolve this issue.
      First you need to turn off the flow and update the app setting value to “yes or no”. Then enable the flow and change app setting value to yes for multisession this time flow should run and update the navigation type. Hope that will help.

      Like

Leave a comment