+ Start a Discussion
SFDC developer55SFDC developer55 

compare old field value with the next field value

Object A

field A
________

A
A
B

I need to compare field value before update record..

for e.g: If current and last field value is same then do something else other stuff

if(old == new)
else
{
}
can we use this using apex code without writting trigger..

List<myObject__C> obj = [Select A from myObject]

for (myObject abc: obj)
//here I need to compare the value of previous and current record...
like if(old == new value)

can you please help me on this?
MagulanDuraipandianMagulanDuraipandian
Chcke this 

http://www.infallibletechie.com/2013/01/triggerold-example-in-salesforce.html

If this solves your problem, kindly mark it as the best answer.
Hit Like, if it saved your work :-)

Regards,
Magulan
http://www.infallibletechie.com
Vinit_KumarVinit_Kumar
Trigger provides the access to current context of the record .How owul you recognize that a field has been changed in a Class,are you stroing the old value somewhere.??

If not,then you need to check in your update Trigger ??