Pages

Tuesday, September 9, 2014

Groovy : Posted Attribute Value using groovy

How to get the posted attributeValue using Groovy .

 To expose old value of entity objects, follow steps below :

1.  Create transient attribute "OLD_SALARY" in Entity Object.
2. Make sure that "Persistent" and "Derived From SQL Expression" properties are turned off.
3. Set the "Value Type" to Expression and enter the following Groovy expression into the Value field:

adf.object.getPostedAttribute(adf.object.getAttributeIndexOf(model.EmployeesImpl.SALARY))

That's it... Now  old salary attribute holds the value of salary retrieved from database. If required same attribute can be used in viewObject ...

Enjoy.