Salesforce Offline Record filter
In this guide, we will explain how to use the offline record filter to filter the records for offline use. If you have any questions, please email us support@formyoula.com.
If we want to filter the records available for offline use based on the value of valid API fields in Salesforce, the offline record filter option can be used.
Here are the few examples which will guide us to how a record filter syntax should look like for offline use.
Use-Case 1: Offline record filter based on merge field
(function(result){
var Name = formyoula.form_fields["2ccf-975e-4ca9"].get('value');
return (result.Name == Name )
})
Use-Case 2: Offline record filter based on certain account name here it will filter all the records with the account name "test."
(function(result){
var Name = "test";
return (result.Name == Name )
})
Use-Case 3: Offline record filter based on the account name, type, and other valid API fields
(function(result){
var AccountId = 1234567890;
var AccountNumber = '1234567890';
var Active__c = true;
var Type="Prospect"
return (result.AccountId == AccountId && result.AccountNumber ==AccountNumber && result.Active__c == Active__c && result.Type == Type )
})
Use-Case 4: Offline record filter based on Email value equals to the email of the user logged into the Formyoula.
(function(result){
return (result.Email == window.formyoula.form_fields.Formyoula_User_Email )
});
Similarly, we can create function for other fields. For example, to filter Email = username of the logged in user, we can use the following function
(function(result){
return (result.Email == window.formyoula.form_fields.Formyoula_User_Username )
});
Here is the Json of an example form with various lookup with filters added based on the use case .
OFFLINE RECORD FILTER[GUIDE].json
Note:
For offline record filter to work correctly in offline mode,
Display Additional field option in the salesforce lookup, "Salesforce select, grid or table should have selected the API field based on which we are filtering the records. For example, if we are filtering the records based on Email = "xyz@xyz.com," then Email should be the field selected in the display additional field option, as shown in the image below.
If you have any questions, please email us support@formyoula.com.