Versions Compared

Key

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

S4S Cloud The Send2CRM service provides a mechanism to add custom form validation that runs in Salesforce prior to processing form submissions.

...

Create an Apex class that implements the FuseIT_S4SCloudsend2crm.FormValidator interface.

Code Block
languagejava
global interface FuseIT_S4SCloudsend2crm.FormValidator {
    
    /**
     * Determine whether form data is valid and should be processed.
     * @param data The parsed form object with field values.
     * @return True if the form should be processed, false to cancel.
     */
    Boolean isValid(FuseIT_S4SCloudsend2crm.FormData data);

}
Note

Implementation If using a public Site for the Send2CRM API, implementing classes should use global inherited sharing, because form validation occurs during anonymous calls to public endpoints. The context user is that configured in the Salesforce Site.

The FuseIT_S4SCloudsend2crm.FormData object contains the form field values submitted from the website. Access these values using the following method. The return value will be of the appropriate type if found, or null if not found.

Code Block
languagejava
global with sharing class FuseIT_S4SCloudsend2crm.FormData extends JsonData {
  /**
    * Get a single field value.
    * @param fieldName The field name/key excluding the standard prefix.
    * @return The field value if found, otherwise null.
    */
  global Object getFieldValue(String fieldName);
}

...

To use the validation for a form mapping, it needs to be available in the Validator (FuseITsend2crm_S4SCloud__Validator__c) picklist on the S4S Cloud Send2CRM Mapping object. The API name must be the exact name of your validation class, including namespace if applicable.

...