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
Ankita Kumari 68Ankita Kumari 68 

Cancel delete trigger and restore deleted records

I would like to create a Trigger to set EndDate of record when user clicks Delete button and cancel the delete request.
Which means when user clicks delete button on contact object, trigger should not delete the record rather just set EndaDate.
 
I have tried beforeDelete and afterDelete triggers but I'm not able to pass values for undeleting the record from trigger logic
 
Can anyone give me right direction to do so?

Thanks in advance!

 
SandhyaSandhya (Salesforce Developers) 
Hi,

Check with below link where you have sample code for the same.

http://www.force2b.net/index.php/2009/03/logging-deleted-records-in-salesforcecom/
 
https://developer.salesforce.com/forums/?id=9060G0000005ehGQAQ
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya