Activity Forums Salesforce® Discussions How to get the old value of a field in a Salesforce Apex Controller?

  • Shubham

    Member
    February 26, 2018 at 3:41 pm

    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.

     

  • Ajay Prakash

    Member
    February 27, 2018 at 4:06 am

    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.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos