/
Custom Form Validator
Custom Form Validator
Example validator class for custom Salesforce form validation.
/**
* Custom form validator example.
*/
// global access modifier so the class can be accessed outside the namespace, i.e. within the send2crm package.
// inherited sharing as this will be called via anonymous endpoints in the public API Site.
global inherited sharing class MyCustomValidator implements send2crm.FormValidator {
/**
* Perform custom validation.
* @param data The parsed form object with field values.
* @return True if the form should be processed, false to cancel.
*/
public Boolean isValid(send2crm.FormData data) {
// Check a submitted form value.
Object myValue = data.getFieldValue('myCustomField');
if (myValue instanceof String && (String)myValue == 'valid') {
return true;
}
return false;
}
}
Add custom validator classes to the Validator (send2crm__Validator__c
) picklist on the send2crm Mapping object to make them available in the mapping wizard dropdown.
, multiple selections available,
Related content
Salesforce Custom Form Validation
Salesforce Custom Form Validation
More like this
Mapping Object
Mapping Object
More like this
Error details on form submission failure
Error details on form submission failure
More like this
Working with the SalesforceGenericEntity
Working with the SalesforceGenericEntity
More like this
Minimum website form
Minimum website form
More like this
Google reCAPTCHA Validation
Google reCAPTCHA Validation
More like this