• #25584
     saloni gupta #419

    How to get the old value of a field in a Salesforce Apex Controller?

    I have to access the old value of a field in Apex Visualforce Controller.


    Salesforce | Shubham Shubham #950

    Hi Saloni

    You can get the old value of a field in Apex VF controller by writing following line of code in the constructor of your Apex controller.

    oldRecord = controller.getRecord().clone();

    If you want to do it only in Vf page then you will need to clone the original object.

    Hope it may helps.


    Salesforce | Ajay Prakash Ajay Prakash #185

    The above solution will help you definitely. There can be one more possible approach that you can perform a SOQL query on the object in the current transaction where you want old values of any record.

Viewing 3 posts - 1 through 3 (of 3 total)

Please to reply to this topic.

Popular Salesforce Blogs


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2020 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?