Monday, May 13, 2013

How to Quickly Check the Old Value in an APEX Trigger

Using the Old Map context variable in a trigger can quickly look back at the old value of a field in a trigger. This can be helpful when you need to write a trigger that is checking to see if a value has been changed...

for ( lead l_new: Trigger.new ){

     if ( l_new.Status != Trigger.oldMap.get ( l_new.id ).Status ) {
   
     }

}



No comments:

Post a Comment