Skip to main content
This content is now archived and is no longer updated. Progress is not calculated. Pega Cloud instances are disabled, and badges are no longer awarded.

Validating field input

Pega Community logo

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

Ensure that the user input on a form meets the required conditions before the case moves to the next step in the life cycle. By validating field input, you check whether the data values that users enter are valid and whether the system can process the information correctly. For example, you can ensure that the customer provides their name and address before placing an order.

Note: You define validation conditions that check whether the user input on the form is incorrect. If the user input matches the validation parameters, an error message appears when the user tries to submit the form.
Before you begin: Create a case type, and then define a case life cycle that has stages and processes with assignments. The forms in your assignments must have fields that you want to validate. For more information, see Automating work by creating case types.
  1. In the navigation pane of App Studio, click Case types, and then click the case type that you want to open.

  2. In the Case life cycle section, select the step to which you want to apply the validation condition.

  3. In the Step pane on the right, on the General tab, click Configure view.

  4. Optional:

    To ensure that the user enters a value in a field before submitting the form, set the field as Required.

    1. In the view configuration window, on the Fields tab, locate the field that you want to set as Required.

    2. In the Options list for that field, select Required.

      When the user tries to submit the form without a value in a required field, an error message appears.

    For example: To prevent the user from submitting a form without entering the date of birth, set the birth date field as Required.
  5. In the view configuration window, on the Validations tab, click Add condition.

  6. Optional:

    To display an error message when the validation fails, in the Message field, enter the text of the message.

  7. Define the validation conditions for a field on the form:

    1. In the list of fields, select the name of the field that you want to validate.

    2. In the comparator list, select the test that you want to perform on the field.

    3. In the value field, enter or select a value to compare against the user input.

      The Select values option lists the fields and values from your form that you can use in the condition.

    For example: To ensure that the birth date is not set in the future, select the birth date field from the list, set the is after comparator, and then select Today from the calendar control. When the user tries to submit the form with a birth date that is set in the future, an error message appears.
  8. Optional:

    To create a condition with multiple validation parameters, add a logical operator to the condition:

    Choices Actions
    Ensure that the condition passes when all properties meet the criteria
    1. On the right side of the row, click the Add a row icon.

    2. In the operator list, select and.

    3. In the list of fields, select the name of the field that you want to validate.

    4. In the comparator list, select the test that you want to perform on the field.

    5. In the value field, enter or select a value to compare against the user input.

      The Select values option lists the fields and values from your form that you can use in the condition.

    Ensure that the condition passes when either property meets the criteria
    1. On the right side of the row, click the Add a row icon.

    2. In the operator list, select or.

    3. In the list of fields, select the name of the field that you want to validate.

    4. In the comparator list, select the test that you want to perform on the field.

    5. In the value field, enter or select a value to compare against the user input.

      The Select values option lists the fields and values from your form that you can use in the condition.

    For example: In a recruitment form, the user must indicate the time of employment at a specific company by entering dates in the From and To date type fields. To ensure that the start date is before the end date, and that the end date is after the start date, you can configure a validation condition with the AND logical operator, as in the following figure:
    Validation of the employment date range
  9. Optional:

    To define more validation conditions, repeat steps 6 through 9.

  10. Click Submit.

Result: At run time, the application evaluates all validation conditions. If any condition is met, an error message appears, and the user cannot submit the form until they correct the invalid fields.

  • Validating field input in complex scenarios

    Create validation rules to check whether the data values that users enter meet specific criteria, and whether the system can process the information correctly.

  • Adding a validation rule to a flow action

    Ensure that the data that your users provide meets the conditions that a case requires in order to go forward. By assigning validation rules to flow actions, you can prevent users from entering information that your application cannot process, and reduce the number of processing errors.

  • Forms and fields

    A form is a view of your data. The fields on a form store user input that can include single-value fields, a group of values, or a list of values. After you create a form, you can associate it with an assignment or approval step in the life cycle of a case.

  • Restricting user input in a field

    Configure fields in your data model to change the way that they store or display information to create a robust data model that is tailored to your business requirements.


This Topic is available in the following Module:

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