function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ThathulaThathula 

How to get old status in Task (Get old status and compare with latest value)

Hi i need to compare new status and previous status in Task. I've a VF page and its controller.
How can i compare new(after user changed) and old staus(before user change) in apex controller class. Its pretty easy in Triggers, but when it comes to the controller class?

Thanks all my friends.. 
Pritam ShekhawatPritam Shekhawat
Hi Thanthula,
                    Take a look similar question here  ​Apex Class - Compare Old vs. New Values (https://developer.salesforce.com/forums/?id=906F000000092PxIAI)



Thanks,
Pritam Shekhawat
ThathulaThathula
Hi, I don't want to iterate through values, I just need to get TaskObj.oldStatus and new status..
Any clues?/
Thank a lot 
ThathulaThathula
I was able to do this by 
Task beforeUpdate=[Select status from Task where id=:TaskO.id];
if(beforeUpdate.status == TaskO.status)


Thanks a lot for everyone
Pritam ShekhawatPritam Shekhawat
Glad to hear :) Also close this question by mark as best answer to help others in future.