Points to consider when adding validation rules
When you select the Validate check box for the selected Response Type option of an Input field on the Fulfillment tab of a Request Definition, you need to keep some considerations for validation rules.
- The validation rule for an Input field is evaluated only if a user enters a value in the corresponding Input field. For example, if a validation rule is defined specifying the maximum and minimum values for a Number Response Type of Input field, and the user does not enter a value in the Input field, then the validation rule is not evaluated when the user submits the request. If the above Input field is defined to be a Required field, users must enter a value that is within the range defined in the validation rule to submit the service request.
- The validation rule section should contain the condition that specifies the valid data for that Input field. Error message are displayed if the validation rule condition evaluates to False. For example, if validation rule section specifies the maximum and minimum values for a Number Response Type of Input field, then the two values define the valid range of values that the user can enter in that particular field. If user enters a value that is not in the specified range, an error message is displayed when the user tries to submit the service request.
- When a user submits a service request, Remedyforce application evaluates all validation rules defined for the Input Fields for the service request. If multiple validation rules fail, then a maximum of 10 validation error messages are displayed at a time to the user.
You can customize the error messages that are displayed in case any of the validation rules fail. The error messages can be customized like other labels. To know more about how to customize a label, see https://help.salesforce.com/HTViewHelpDoc?id=cl_edit.htm&language=en_US.
The Validate check box is available only if you select the following Response Type options:
- Date and Date/Time: You can create validation rules for the Date Response Type to limit the entered date in the input field as </> than Specific Date, Current date or any other date that is defined as an input field. If you select the Current Date or any other input that is of Date or Date/Time Response Type, for the validation rule, you can also specify the number of additional days allowed.
For example, if you have already defined Start Date as an input field and you want to create a new input field End Date.
You can create a validation rule to limit the entered date in the End Date field as </> than the Specific Date, Current Date, or Start Date. If you select the Current Date or Start Date, you can specify the number of additional days allowed.
Also, if a Start Date field is defined on a New Hire Service Request Definition and the field is mapped to a field in the service request, you can create a validation rule for the input field to prevent the submission of the service request if the person is joining in less than 7 days. The validation rule is created as:
Employee Start Date + 7 (days)
- Number: You can create a validation rule for the NumberResponseType to limit the minimum or the maximum number allowed in the input field.
- Picklist: You can create a validation rule for the Picklist Response Type to define the minimum number of options to be selected by the user for the input fields.
The Validate check box for the Picklist Response Type is available only if the Allow Multiple Select check box is selected.
For example, if you create a picklist type Input field Applications in Laptop that contains five picklist values. You can create a validation rule to define that the user needs to select minimum two values for the Input field.
- Text Field: You can create a validation rule for the Text Field Response Type to define the minimum number of characters the user needs to enter in the input field.