Skip to main content
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Data validation

When you design a View, you add all the fields and controls that the specification requires. You must also consider how to ensure that the data values generated by users are valid. Valid data is required so that the system can process the information without error. Some data requirements are outlined in the following table:

Data requirements Examples
The data must be the right type. For example, users must enter a number in a Total purchase units field.
The data must be restricted to possible values. For example, users can only choose a valid loan type by selecting the type from a list of options.
The data must fit the business logic. For example, a Date of birth field must be in the past.

To prevent processing errors, Pega Platform™ provides field types and controls to support validation requirements. Choosing the right control may be sufficient to satisfy a validation requirement. In cases where a control or field type is insufficient to perform data validation, Pega Platform provides data validation by using business logic to test fields with conditions. 

For example, you can use a calendar control to ensure that the data entered by users is a date, regardless of whether the format is dd/mm/yyyy or mm/dd/yyyy. But you cannot use a calendar control to ensure that a Start date field in an employment history form captures a date in the past. Instead, you can validate the date is in the past using business logic.

Note: For more information on configuring forms in a View, see Configuring forms.

Business logic data validation

You use App Studio to perform simple business logic validations that compare the value of a field against a constant value when users submit a form. You create conditions that define invalid data values so that an error message is displayed when the condition is met. If users generate a value that meets the condition for an invalid value, the system displays an error message and prevents the user from continuing the Case until the issue is resolved.

In the following image, click the + icons to learn more about how to configure a validation condition to ensure users enter a value greater than 100 in the Enter digit greater than 100 field:

Business logic validations are often associated with Processes in the Case Life Cycle, enabling you to validate each field instance based on distinct business logic validations. The business logic validations that define acceptable values are separate from the fields that capture data. For example, a Date of birth field is validated when users enter the date on the field. The validation is not applied again when the field is used later during Case processing.

Multiple forms may use the same field and apply different validation conditions for each instance of the field. For example, in the HR App, HR representatives enter information in two forms, the Job History form, and the New Hire form. In the Job History form, an HR representative enters the start date of an employee who already works at the company. The HR representative must enter a date before the current date. In the New Hire form, an HR representative enters a start date for an employee who has not started work. The HR representative must enter a start date after the current date. Using two business logic validations, one for each business condition, you can ensure that the correct dates are entered on each form. 

In App Studio, you can validate the value of a field when you submit a form or when the Case enters a Stage.

 

Check your knowledge with the following interaction:

Validation on a form

You use business logic validations on a form when you cannot predict or control the value that users enter. You configure business logic validations on a form, and the validation is triggered when users submit the form. If users submit a form that contains a value that meets the condition for invalid data, the form displays an error, and the system prevents the users from continuing the Case until users submit data that passes the condition. Use validation on a form when users can perform an immediate action to resolve the invalid data, such as entering a new value in a field.

For example, assume a form contains a date of birth field. The field type and control cannot prevent users from entering and submitting a date that is in the future. However, you can design a business logic validation to display an error if users submit a date that is in the future. The form can be submitted once users enter a date in the past.

In the center of the following image, slide the vertical line to view the step configuration to validate the Date of birth field on the left and the error message that is displayed in the form on the right:

Validation on a Stage

You can also use business logic validation on a Stage. Use business logic validation on a Stage to ensure the application has generated the correct data and that users have entered the correct data or performed the appropriate actions before the Case enters a specific Stage. You configure business logic validations on a Stage in the Case Type Data Model, and the validation is triggered before the Case enters the specified Stage. On a Stage entry validation, if a data value meets the condition for invalid data, the Case cannot enter the Stage, and an error message is displayed.

Note: When an error message is triggered on a Stage validation, end users need to have the ability to update invalid data or perform an action, such as returning to a previous Stage or closing the Case. It is up to the developer to configure the functionality that allows end users to resolve the validation error.

For example, in a mortgage application, a valid credit score must be available before the Case can enter the underwriting Stage. The application informs the user that the credit score is invalid, and the user is allowed to verify the credit history on file or cancel the process.

In the following image, click the + icons to read more about configuring validations in the Case Type Data Model:

Check your knowledge with the following interaction:


This Topic is available in the following Module:

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

Did you find this content helpful?

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