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
Kartik BhallaKartik Bhalla 

how to get old value of a field in undelete trigger salesforce

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Kartik,

We cannot get the old values in undelete context. 

Undelete event just restores the deleted record. Also, the id of the record remains the same after it is restored. 

Please find the below reference link for the same.

https://developer.salesforce.com/forums/?id=9060G0000005oDfQAI

If this solution helps, Please mark it as best answer.

Thanks,
 
Kartik BhallaKartik Bhalla
Hi Praveen, I am making an after undelete trigger for restoring the records on the same position as it was on before deleting & for that I need the  old value of a sequence number field(custom field). I have a custom number field which I am incrementing sequentially using insert trigger. Suppose I have 5 records who're having sequence num 1,2,3,4,5 and now if I delete one record(say 3) I rearranged the list to 1,2,3,4 using the delete trigger but now if i want to restore it back to the same position after undelete what should I do plz help...