Application Configuration

Giving admins the power to tweak the app

Overview

Dynamics Mobile SDK provides several options for the developer to work with persistent data, which includes relational database and files.

Additionally Dynamics Mobile SDK provides Configuration API.

The Configuration API stores key/value pairs, which can be read via special API.

Example

Let's assume the following code:

//try read to read dateFormat setting value
let dateFormat = await this.ConfigurationService.getSetting('dateFormat');
if(!dateFormat)
dateFormat = 'yyyy-MM-dd'
const dateStringToPrint = (new Date()).format(dateFormat)
console.log(dateStringToPrint);

The code here, tries to read the value of setting called "dateFormat" (line #1). It is supposed that this setting contains a formatting string for dates, used across the app. The settings are read via the ConfigurationService class

On line #2 we make sure that this setting actually has value and provide a default value if not.

On line #4 we use the setting to format the current date with proper string representation.

If you have this code in your app, at first the dateFormat setting will return undefined, unless the system administrator of the application area , changes the dateFormat setting for a given user role. This means that the developer can allow the administrators to configure and tweak the behaviour of the apps via set of configuration settings.

See also:

ConfigurationService class

Dynamics Mobile Portal: Roles