Validate User inputs on-the-go using Groovy Expressions

It is often required to validate values input by users, especially while capturing details such as National Identifiers/Contact Info/Previous Employment Dates where a validation needs to take place to ensure correctness of the details entered.

Oracle HCM Cloud offers an effective functionality to validateflexfield entries through Validators and throw appropriate error messages in case of incorrect entries. The validations are performed via Groovy Expressions, a scripting language.

Key Features:

  • Multiple built-in ready-to-use functions
  • Validate your expression on the go
  • Use regular expressions for pattern matching validation

Configuration Steps to enable Groovy Expressions:

To illustrate the use of Groovy Expressions in Validators, let us take the example of validating a PAN / Aadhaar Number entry by users in a Checklist Task, during their On boarding phase.

Step 1: Open Manage Descriptive Flexfields in Setup and Maintenance.

Step 2: Search the required Descriptive Flexfield that contains the field to be validated.

Step 3: Navigate to the required context through Manage Contexts.

Step 4: Under Validators, click the Add button (+).

Step 5: Enter a unique code for your Validator and click on Groovy Expression Builder button under Validator Expression.

Step 6: Groovy Expression Builder opens where the expression palette can be used to insert built-in Functions/Fields/Keywords/Web Services into your expression.

Step 7: Enter the validation expression. Here, to validate PAN entry, regular expression has been used to match the pattern of the user’s input to the standard pattern of a PAN ID.

Step 8: Validate your expression as shown below to avoid mistakes.

Step 9: Once successfully validated, click OK and continue to deploy the flexfield.

Step 10: Test the validation real-time.

Checklist Task was completed successfully by the user on entering a valid PAN and Aadhaar Number.

Business Benefits:

  • Validate any kind of user input
  • Reduce incorrect user entries
  • User-friendly guidance to enter correct data

Author
Mithila Sriram
Oracle HCM Cloud Team