Installation and Setup > Configuring Mobile Apps > Salesforce Configurations > Salesforce Custom Settings in Download Criteria
Salesforce Custom Settings in Download Criteria
Salesforce Custom Settings can be used in the Download Criteria expression, to filter the records of any object. The filtering is done based on match between an object field and a custom setting field. This makes it possible for mobile apps to filter records of any object for any user, based on conditions specific to the user or user’s Salesforce profile, using the same mobile configuration in ServiceMax.
This feature enables filtering of records specific to the logged in user, without the need for formula fields. A query based on formula field is not efficient, as it results in full-table scan, with evaluation of the formula field value for all the records at the time of query. So, using custom settings instead of formula fields will result in improved query performance, and hence reduced sync times. Refer to Salesforce Help for more information on Custom Settings.
Custom settings of types List and Hierarchy, which have Public visibility, are supported. However, only custom setting fields of data type Text and Text Area are supported. Such custom setting fields can be matched with text type fields in any object.
In Mobile Configuration screen, Download Criteria tab expression builder has been enhanced to support the following: For any filterable text type field (e.g. text, text area, picklist), select the required operator, and enter the custom setting name in the Value field. Format to specify the setting name is as follows:
Hierarchy type setting: SVMX.SFCSH.<Custom Setting API Name>.<Custom Setting Field API Name> Example: Territory Equals SVMX.SFCSH.Covered_Territory__c.Territory_Name__c
List type setting: SVMX.SFCSL.<Custom Setting API Name>.<Custom Setting Field API Name>:<Name of the data set> Example: Region Code Equals SVMX.SFCSL.Region_List__c.Region_Code__c:North East US
* 
The Equals and Contains operators are supported on custom settings expressions in Download Criteria. Expressions which include custom settings are not supported in Advanced Download Criteria. No other app/feature in ServiceMax suite supports expressions that include custom settings.
An example usage of Hierarchy type of custom setting:
1. Consider a custom setting labeled Covered Territory (API Name: Covered_Territory__c) of type hierarchy, with custom field of type Text, labeled Territory Name (API Name: Territory_Name__c).
2. Set this to England for technician1’s Salesforce user and Germany for technician2’s Salesforce user. Both the technician users are associated with the same Salesforce profile and hence have the same ServiceMax group profile.
3. In the Mobile Configuration for the ServiceMax group profile of these technician users, Download criteria expression can be defined to match Installed Product custom text field Territory with this setting value, as follows: Territory Equals SVMX.SFCSH.Covered_Territory__c.Territory_Name__c
4. With the above configuration, following records will get downloaded when different technicians login to the mobile app:
For technician1: Installed products which have Territory = England
For technician2: Installed products which have Territory = Germany
In older releases, formula fields had to be used for the above purpose. For the above example, a formula field of type Number (named Download To Mobile) had to be defined, with the following formula:
IF(Territory__c = $Setup.Covered_Territory__c.Territory_Name__c, 1,0
This formula field had to be included in the Download Criteria expression as follows:
Download To Mobile Equals 1
Extending the above example, if the covered territory were to be defined for the Salesforce profile instead of for the individual technician’s user record, setting definition and Download Criteria expression in mobile configuration would remain the same. It is just the setting data which would need to be defined for the required profiles, instead of for the individual users.
Once defined, records matching the territory name of profile1 would be downloaded for all the technician users associated with that profile; records matching the territory name of profile2 would be downloaded for technician user’s of profile2.
Was this helpful?