A unique feature of the Dynamics Mobile applications is the ability for the administrators to configure the mobile functional modules by using”server-side settings”.
The server settings are key-value pairs setup by the system administrator for each device role. The server settings then are sent to each device and can be read from the developer to run specific code depending on the setting values.
The developers have to decide the settings, which they app will support and make them available in the documentation.
Reading settings
Dynamics Mobile provides a special API allowing the developer to read the settings:
They can be read by using the following “class”:
$ma.cfgManager
if we want to check the value of a specific setting for our current module, we can use the following code:
if($ma.cfgManager.get('myOption1',function(value){if(value=='true'){
...do something
}})
The developer does not have to take care of the server settings synchronization. The mobile app framework will make sure that the latest settings are retrieved from the server depending on the actual synchronization method used ( on-line, off-line ).
This way the mobile functional modules can allow for simple customization with the need of an experienced developer.
Note that actually the administrator will have to enter the setting for the device role pretended with the module’s unique code. if we have module with code SLA, the administrator will enter myOptions setting in the following manner:
SLA.myOptions1
However, the developer will still have to use only the settings name without the module code prepended ( as shown in the example )
Writing settings
The developer can write settings using the same cfgManager “class”
$ma.cfgManager.set('mysettings','value1',function(){alert('writing completed')});
The setting with name mysetting will be written locally on the device with value value1. Note that the setting and value is only stored locally on the device. It will be stored until the app is uninstalled or the user uses the “Clean Install” or “Wipe out” option from the mobile device.