Skip to main content

Validating field input in complex scenarios

Pega Community logo

Note: The following content, referenced from Pega Community, is included here to help you better achieve the module learning objectives.

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.
  1. In the header of Dev Studio, click Create Process Validate .

  2. On the New tab, define the label, context, and ruleset for the new validation rule, and then click Create and open.

  3. 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.
  4. 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.
  5. In the Conditions section, create a validation set by clicking Add.

  6. In the Validation conditions window, define the validation set:

    1. Ensure that the Enable conditions check box is selected.

    2. Optional:

      To indicate that the user must fill out a field, select the Required check box.

    3. Optional:

      To force the system to evaluate subsequent properties even if the current evaluation fails, select the Continue validation check box.

    4. In Select a function, choose the function that you want to use to evaluate the property.

    5. In the fields below, enter the expression for the function.

    6. In the Message field, enter the text you want to display when the condition is true.

    7. Optional:

      To add an additional validation function, click Add a row, and then select a logical operator to link the functions.

    8. 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 .DownPayment IS LESS THAN 1000. In Message, enter Down payment not sufficient. Now, if the down payment amount is lower than 1,000, an error message appears.
  7. If your validation rule includes multiple validation sets for different input values, you can define additional validation sets:

    1. In the upper right corner of the Validate tab, click Add a new condition.

    2. In the Input row, enter the input value for which you want to create a validation set.

    3. Configure the validation set by completing steps 6.b through 6.h.

    4. 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.
    Validation sets for two input scenarios
    A validation rule that checks if a customer has a minimum down payment. If a customer is in a high-risk group, the down payment increases from 1000 to 1500.
  8. Optional:

    To run additional validation rules after the current validation completes, in the Additional validation row, select the target validation rule.

  9. Click Save.

Note: Associate the validate rule with a flow action. For more information, see Adding a validation rule to a flow action.

  • Validating character patterns

    Check whether the input that your user provides is relevant. By verifying character patterns with edit validate rules, you can ensure that the data that users enter into forms matches the field requirements, and reduce the number of processing errors.

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

25% found this content useful

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice