Creating Custom Validations

You can create a custom validation.

To create custom validations

  1. Make sure the form_validator object is defined.

    For more information, see Preparing to Use Validation.

  2. Add the following code to the forms.js file:

    validator.add_custom(“function_name“,“fields_to_highlight“,“string_key“);
    

    where:

    • function_name is the name of a function that does the validation. Siebel CRM Desktop calls this function before it saves the record. This function gets the ctx object as input and allows it to access data and form items. This function must return one of the following values:

      • true. The validation is successful.

      • false. The validation is not successful.

    • fields_to highlight is an array of control identifiers that Siebel CRM Desktop highlights in the client if the validation fails.

    • string_key is the string key in the resource file that contains the text for the message that Siebel CRM Desktop displays in the client if the validation fails.

  3. Test your changes and then republish the customization package.

    For more information, see Republishing Customization Packages.