Referencing Original Values of Changed Fields

When the value of a field gets changed during the current transaction, the ADF framework remembers the so-called "original value" of the field. This is the value it had when the existing object was retrieved from the database.

Sometimes it can be useful to reference this original value as part of your business logic. To do so, use the getOriginalAttributeValue() function as shown below (substituting your field's name for the example's Priority_c):

// Assume we're in context of a TroubleTicket
if (isAttributeChanged('Priority_c')) {
  def curPri = Priority_c
  def origPri = getOriginalAttributeValue("Priority_c")
  adf.util.log("Priority changed: ${origPri} -> ${curPri}")
  // do something with the curPri and origPri values here
}