Pages

Monday, July 2, 2012

Using groovy expression for throwing dynamic error message

In this post, I will explain a simple use case of groovy expression for throwing error message.

If there is a Business rule defined on an Entity Object attribute such that, a Date value cannot be less than the current Date and if this Business Rule is violated an error message should be thrown like : The value entered, <enteredDate> is less than the Current Date <currDate>.

For this add an attribute validator on the date attribute.

Select the rule type as Script Expression and define the rule as shown below:


In the failure handling tab, define the message string as shown:


Map the enteredDate to newValue and currDate to adf.currentDate in the token message expressions.

When this rule is violated the error message is shown as:

No comments:

Post a Comment