Class: SVMXC. COMM_Utils_ManageSettings
1. SVMX_getSettingList(String SubmoduleId)
Returns the values of all settings in the given submodule ID as a Map
Example: To retrieve all setting values for Case Entitlement submodule (Submodule ID EVER001):
YourClass(...)
{
Your code...
// Initialize the constructor
SVMXC.COMM_Utils_ManageSettings commUtilSettings = new SVMXC.COMM_Utils_ManageSettings();
Map<String, String> mySettings = settings.SVMX_getSettingList('EVER001');
// Your code to use the settings
String valSet001 = mySettings.get('SET001');
}
2. SVMX_getSettingList(String SubmoduleId, String SettingId)
Returns the values of the given setting in the given submodule ID as a Map
Example: To retrieve the value of the setting Show Future Entitlements in Case Entitlement submodule:
YourClass(...)
{
Your code...
// Initialize the constructor
SVMXC.COMM_Utils_ManageSettings commUtilSettings = new SVMXC.COMM_Utils_ManageSettings();
Map<String, String> mySettings = settings.SVMX_getSettingList('EVER001', 'SET001');
// Your code to use the settings
String valSet001 = mySettings.get('SET001');
}
3. SVMX_getSettingList(String SubmoduleId, List SettingList)
Returns the values of the given setting in the given submodule ID as a Map
Example: To retrieve the value of multiple settings for Case Entitlement submodule:
YourClass(...)
{
Your code...
// Initialize the constructor
SVMXC.COMM_Utils_ManageSettings commUtilSettings = new SVMXC.COMM_Utils_ManageSettings();
// Create a list of setting IDs
List<String> listOfSettings = new List<String>();
listOfSettings .add('SET001');
listOfSettings .add('SET002');
listOfSettings .add('SET003');
Map<String, String> mySettings = settings.SVMX_getSettingList('EVER001', listOfSettings);
// Your code to use the settings
String valSet001 = mySettings.get('SET001');
}
4. SVMX_getFieldMapping(String MapId)
Returns the source to target field mapping configured for the given object Map ID as an array of records from SVMXC__ServiceMax_Config_Data__c object.
Example: This retrieves field mapping between two sample objects, Source_Object__c and Target_Object__c, and copies field values between the two objects using the mappings.
YourClass(...)
{
// Initialize the constructor
SVMXC.COMM_Utils_ManageSettings commUtilSettings = new SVMXC.COMM_Utils_ManageSettings();
// Get the field mapping for a given map ID
SVMXC__ServiceMax_Config_Data__c[] FieldMap = commUtilSettings.SVMX_getFieldMapping('MAP001');
Target_Object__c TObj = new Target_Object__c();
// Use your code to select data from Source_Object__c
// Assuming you have the source record in SObj
//Populate fields and corresponding values using fieldMap
for (SVMXC__ServiceMax_Config_Data__c fld : FieldMap)
{
String targetFieldName = fld.SVMXC__Target_Field_Name__c;
String sourceFieldName = fld.SVMXC__Source_Field_Name__c;
Object sourceFldVal = SObj.get(sourceFieldName);
if(sourceFldVal != null)
{
TObj.put(targetFieldName, sourceFldVal);
}
}