Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
/**
 * Custom form validator example.
 */
// global access modifier so the class can be accessed outside the namespace, i.e. within the S4S Cloudsend2crm package.
// inherited sharing as this will be called via anonymous endpoints in the public API Site.
global inherited sharing class MyCustomValidator implements FuseIT_S4SCloudsend2crm.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(FuseIT_S4SCloudsend2crm.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 (FuseIT_S4SCloudsend2crm__Validator__c) picklist on the S4S Cloud send2crm Mapping object to make them available in the mapping wizard dropdown.