Create validation rules to check whether the data values that users enter meet
specific criteria, and whether the system can process the information
correctly.
While step validation supports relatively simple comparisons, validation rules help you
create more complex operations that include functions and conditional processing. For
example, a loan application might require different validation conditions depending on
the risk rating of the applicant. You can set up a RiskLevel
property with a value of High, Medium, and
Low, and define a set of validation conditions for customers
that represent High, Medium and
Low risk levels.
Note: You define validation conditions that check whether the user input in a form is
incorrect. If the user input matches the validation parameters, an error message appears
when the user tries to submit the form.
In the header of Dev Studio, click Create > Process > Validate.
On the New tab, define the label, context, and ruleset
for the new validation rule, and then click Create and
open.
On the Input tab, define the input that the application
uses to determine which set of validation conditions to apply at run time:
To define only one validation set, select
None.
To define a separate validation set for each value of a property, select
Input property, and then select the target
property.
To define a separate validation set for each case status, select
Proposed work status.
To define a separate validation set for each flow action, select
Flow Action Name.
To define a separate validation set for each stage, select
Stages.
For example: To set up separate validation sets for customers with
High, Medium, and
Low risk levels, select Input
property, and then enter RiskLevel as the
target property.
On the Validate tab, in the
Property field, enter the property that you want to
test.
For example: To test whether the amount of a down payment is sufficient, in the
Property field, enter
DownPayment.
In the Conditions section, create a validation set by
clicking Add.
In the Validation conditions window, define the validation
set:
Ensure that the Enable conditions check box is
selected.
Optional: To indicate that the user must fill out a field, select the
Required check box.
Optional: To force the system to evaluate subsequent properties even if the
current evaluation fails, select the Continue
validation check box.
In Select a function, choose the function that
you want to use to evaluate the property.
In the fields below, enter the expression for the function.
In the Message field, enter the text you want to
display when the condition is true.
Optional: To add an additional validation function, click Add a
row, and then select a logical operator to link the
functions.
Click Submit
For example: To test whether the down payment meets the required minimum, in the
Select a function list, select
CompareTwoNumbers. Next, in the fields below, enter
.DownPaymentIS LESS THAN1000. In Message, enter
Down payment not sufficient. Now, if the down payment
amount is lower than 1,000, an error message appears.
If your validation rule includes multiple validation sets for different input
values, you can define additional validation sets:
In the upper right corner of the Validate tab,
click Add a new condition.
In the Input row, enter the input value for which
you want to create a validation set.
Configure the validation set by completing steps 6.b through
6.h.
Optional: To run another validation set after the current validation completes,
in the Also execute row, specify the target
validation set.
For example: To create a validation set for high-risk customers, in the
Input row, enter High. Next, add
an error message and a validation set that evaluates if the
.DownPayment property is lower than 1,500. Now, if a
high-risk customer offers a down payment of 1,200, an error message appears,
even though that amount would be sufficient for other clients.
Optional: To run additional validation rules after the current validation completes, in
the Additional validation row, select the target
validation rule.