Dynamic (parameterize) model level validation using message token -Oracle ADF

Sharing is Caring

Hello all
This post falls under ADF Basics category (about a little trick in the model layer) but about a common development requirement regarding model level validation.
How can we create dynamic ADF BC validation? means it takes a parameter at runtime and appends it to the validation message

Read the previous post on model level validation-
Conditional Execution of Model (EO) level Validation- Oracle ADF
ViewObject Validation rules for transient attributes (Model-level validation in ADF)

In this post, I am using Departments table of Oracle HR Schema

    • The first step is same, prepare model (EO, VO and AM) using Departments table


    • Creating a business rule that DepartmentName cannot be duplicate, for this created an alternate key in EntityObject


    • Now creating unique key business rule for this alternate key and message that appears on validation failure (this is how we apply EO level validations)



    • Run AM and check in BC4J tester, create a new row and on entering duplicate DepartmentName this validation message appears -“Duplicate Department Name



    • Now my requirement is this message should be like – Duplicate Department Name <Administration>, so for this, I have to pass parameter in the message that shows entered DepartmentName on run-time. ADF provides a built-in feature to pass tokens in the message and on the runtime it is replaced with groovy expression value


On running see desired output

  • to pass more than one parameter just add another token and set groovy for it, see the screens


model level validation
Cheers 🙂 Happy Learning

Related Posts

0 thoughts on “Dynamic (parameterize) model level validation using message token -Oracle ADF”

Leave a Reply

Your email address will not be published. Required fields are marked *