+ Start a Discussion
Mikko4Mikko4 

ISCHANGED in Apex

Hi,
 
In formulas you can use ISCHANGED function. Is there a similar method in Apex or is there some recommended design pattern for checking if a field value has changed in after update event?
 
How about ISNEW function?
 
Thanks!
Best Answer chosen by Admin (Salesforce Developers) 
MVJMVJ
Look at the Trigger.new and Trigger.old.  the .New has the current value the .Old will have the previous value.

You can compare them to see if a filed has been changed.


All Answers

Mikko4Mikko4
I noticed that ISNEW could be checked with Trigger.isInsert, right?
MVJMVJ
Look at the Trigger.new and Trigger.old.  the .New has the current value the .Old will have the previous value.

You can compare them to see if a filed has been changed.


This was selected as the best answer
edward scott 10edward scott 10
I am trying to do something similar. I have a trigger that makes a lead goes through the lead assignment but it only needs to happened if the status was changed to open. I see you or using .new and .old but how do I use that to check to see if a field value changed?