Tuesday, February 7, 2017

Setting Invalid Fields for the UI in ADF BC Groovy

What if you have entity level validation rule and want to attach validation error message to specific field. By default this is not possible - all entity level validation error messages are displayed in the popup and are not attached to the fields (differently than attribute level validation rule messages).

Apparently there is a way to achieve such requirement with Groovy expression, this can be executed from entity level validation - adf.error.addAttribute('Salary'). In addAttribute you need to provide attribute name which will be assigned with the error. Complete expression for entity validator:


Result displayed on UI - validation error message is assigned to the field, which was changed:


Download sample application - GroovyADFApp_v2.zip.

4 comments:

Anonymous said...

Good Example.
Please correct the message.. It should be 2000 instead of 1000. :)

Andrej Baranovskij said...

This is mistype, doesnt matter - will keep it. Thanks for pointing out.

Andrejus

Sébastien said...

Hi Andrejus,

As you are doing also JET articles, how can you handle this type of validation message in JET? (I'm just curious)

Sébastien

Andrej Baranovskij said...

Hi,

I have a post for this: http://andrejusb.blogspot.lt/2016/01/handling-adf-bc-1221-rest-validation-in.html

Andrejus