Home > Canvas Apps, CRM > [Beginners] Canvas Apps | Options to store configuration data

[Beginners] Canvas Apps | Options to store configuration data

While building Canvas apps, its pretty common ask to store the configuration data or a Dictionary of key and value pairs. As an example, you might be sending an email from Canvas App and you would want the sender email DL (Distribution List) to be configurable. Think of these settings like an ASP.NET web.config file.

In this article, lets see what are the options to store configuration data.

Creating a hidden configuration screen :

An easy way of setting configuration values is just to create a hidden screen and put your configuration values in text input controls. In this way, you can change application settings without editing code.

  • Create a ‘Settings Screen’ and make it as the last screen, so that it’s easily found.
    • I’ve create a simple ‘Settings Screen’ with a text input control ‘txtEmailDL‘.
  • We will restrict the ‘Settings Screen’ screen to the end users by making sure no logic/formula on the App takes Users to this screen. This way the screen accessible only when the app is edited, and Makers or Admin can go to this screen and configure values.
  • Now, lets see how to read the configuration data and use it across the App.
  • I’ve created a flow which expects ‘EmailDL’ parameter from the Canvas App.
  • On my Canvas Apps ‘Main’ screen, I’ve a button which triggers the flow by passing the Email DL value. Here I am reading the txtEmailDL control value from my ‘Settings Screen’ and pass it to the flow.
  • This way yo can read the txtEmailDL control value from ‘Settings Screen’ across all the screens of Canvas application.
Drawbacks of this approach:
  • You must republish the app to change values and make them persist.
  • Because values persist in the app, you must create a process that updates these values before you export the app in preparation for a move to another environment.

Store the configuration data in external source (Dataverse):

Keep in mind that Dataverse requires a premium connector and since you are using Dataverse you will need a premium license. To use this approach:

  • Create a new Dataverse table to store configuration values. Because the values persist outside the app, they can be modified at any time without redeploying the app.
  • As an example, create a table with a custom ‘Data’ column and keep configuration settings required for your Canvas app in json format.
  • Every time you open Canvas App, read the configuration from Dataverse.
Drawbacks of this approach:
  • This approach requires a call-back to Dataverse connector evertytime you open the Canvas Apps. Therefore, there will be a slight effect on performance.

Hope you got some beginner understanding of how to store configuration data and consume in Canvas Apps. If you are a beginner, I highly recommend go through coding standards.

🙂

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment