Custom validation formulas

In addition to validation rules based on the security level, you can define a custom validation formula (rule) to ensure that users' passwords satisfy your security policy. You must use password authentication to define a custom validation formula.

To define a custom validation formula:

  1. Navigate to the Setup home page:

  2. In the Administration Setup section, click Authentication.
  3. On the Authentication page, enter the body of a JavaScript function with a single input parameter, password. The function should return an error message for an invalid password or NULL for a valid password.

The following example ensures that the user's password includes at least one special character: '@' or '#':

if (password.indexOf('@')<0 && password.indexOf('#')<0) 
      return "Password must include a special character.";

After specifying your custom validation formula, you can click Debug Formula to find and fix any errors or inconsistencies in the formula.