How You Add an Error Message Using Autocomplete Rules

The Add error message option enables you to insert a rule line that shows an error message to the user. This option can only be used in Business Object Validation and Field Validation rules.

You can't show an error with Business Object Defaulting or Field Modification rule types. This option is mostly available within a conditional statement. Note that you can't add any rule lines immediately after this, inside the execution path that includes the Show Error statement. This is the end of execution of the rule. You don't have the option to continue rule execution after showing an error.

You can change only the right hand side of a show error statement. By default, you can see a text box in which you can type your error message in the language that follows your language preference of HCM Cloud login.

Click the xyz icon next to the text box to change it to either an existing variable or an arithmetic expression. The arithmetic expression in this case is simply a concatenation of string values that's shown to the end user. This is useful to mix and match literal expressions with values of fields so that the message is more useful and specific. After changing to arithmetic expression, each component of the concatenated string is shown with its own xyz icon allowing you to change individual components to either literal text values or another arithmetic expression. You can set up as many components as needed before typing in your error text or changing some components, or both to show actual values of fields (of type string only). You can ignore the parenthesis, as this will result only in a sequential concatenation of string values. You can't change the only arithmetic operator in this context, the "+" operator. If you want to show a number as part of your error message, you have to convert the number to a string using an object function and store it in a string variable and then reference the string variable.

We recommended you don't display numbers and IDs in error messages. To show numbers in an error message, you first convert the number to a string using a global function. You then use the converted string variable in the error message. To show dates in an error message, you can use the Autocomplete Rules' built-in function Get Date in Custom Format that converts a date field to any format of your choice.

You can also setup various Boolean variables in the rule logic that detects the error condition separate from the conditional statement where you actually show the error. This can trigger specific error messages depending on the error when multiple conditions are checked, as opposed to a generic error message. This is useful in pattern matching scenarios where you can check for multiple patterns at the same time.

A point to note is that you can't use curly brackets or double quotes in an error message. Other types of brackets must be used in pairs, that's any open brackets including { or ( must be closed and vice-versa.

You can translate error messages added using Autocomplete Rules in all Oracle supported languages. But, you need to use only one language when implementing and maintaining messages, otherwise the translation will be overridden. If the rule is edited in another language and saved while the message is already translated, then the message is overridden and translation will be lost.