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
SatheeshDevsinCloudSatheeshDevsinCloud 

Getting the OLD values of related object field in the update trigger

Hi Guys,

 

I have a custom object "OppService__c" in which I have a lookup field some set of values.

 

I have written a trigger which will work when the look up field is selected with a value starting with "RSN" Id of the particular OppService__c record should be sent to my apexclass.

 

My trigger is working fine for insert feature and returning the id to the class.

 

but for update function,  i want to get its Old value to compare so as to if the old value of the field is also starting with RSN the id of the record should not be passed to the class...........

 

 

The Name field in the OddService__C object being the related field from another object, only null value is returned if

I use like this:

 

Trigger.isupdate.getoldmap(RecordID.id).OddService__r.Name.substring(0,3)=='RSN'

 

Please suggest is there any other way to get the old value of the related object field in the Update trigger.

RakeshistomRakeshistom

You can use trigger.old, take value from record and save it in global variable then you can able to use this value through out trigger....