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
Vadivel MuruganVadivel Murugan 

Lookup field value

How to get previous stored lookup value in lookupfield.
surasura
you can enable the history tracking  for that field  and use field history records to determine the old value or you can maintain a another lookup field  and write the old value to that field on lookup field value change. you can use Trigger.OldMap to find the old value in a trigger
Vadivel MuruganVadivel Murugan
give apex code for get previous value for lookupfield
surasura
 for (your_Object__c urobject :Trigger.new)
     {
         if(Trigger.oldMap.get(urobject.Id).Lookupvalue__c != urobject.Lookupvalue__c)
         {
            urobject.OldLookupvalue__c = Trigger.oldMap.get(urobject.Id).Lookupvalue__c
         }
     }

replace your_object__c, Lookupvalue__c , OldLookupvalue__c  with respecitve api Names
Vadivel MuruganVadivel Murugan
I like to get the field value before submit the record
surasura
if you are using custom controller you can save the inital lookup value to a variable on page load and compare it  to with the record value on save