Purpose
Administrators may need to retrieve application-level Managed Configuration (App Restrictions) data and use it for advanced device reporting or dynamic device grouping.
SureMDM now supports JavaScript APIs within the Custom Property rule engine to fetch specific configuration values or the complete managed configuration from an application. These values can then be assigned to Custom Properties for granular device visibility and automation.
Prerequisites
- Access to the SureMDM Console
- A managed Android device with an application that supports Managed Configurations (App Restrictions)
- The package name of the target application
- Custom Property configured in SureMDM
Steps
1. Fetch a Specific Managed Configuration Value
Use this script to extract a specific key (column) from an application’s managed configuration and assign it to a Custom Property.
!#suremdm
function assignValue(){
var value = suremdmjs.getAppManagedConfigValue(“package_name”, “column_name”);
return value;
}
Parameters:
- package_name – The package name of the target application
- column_name – The specific key in the managed configuration to retrieve
2. Fetch the Complete Managed Configuration (JSON String)
Use this script to retrieve the entire managed configuration of an application as a JSON string.
!#suremdm
function assignValue(){
var value = suremdmjs.getAppManagedConfig(“package_name”);
return value;
}
Parameter:
- package_name – The package name of the target application
Note: These scripts are executed via the Custom Property rule engine to dynamically update device metadata based on the application’s current configuration.
Expected Results
- The Custom Property dynamically updates with the retrieved managed configuration value.
- Administrators can use this data for:
- Advanced device reporting
- Dynamic device grouping
- Policy validation
- Configuration audits
Conclusion
With JavaScript API support for Managed Configurations in SureMDM, administrators can now programmatically retrieve application restriction data and map it to Custom Properties. This enables enhanced visibility, automation, and granular device management based on real-time app configuration data.
Need more help? Here’s how to get help from our experts.