Unfortunately I deleted a trigger, and now I want it back. I've checked the Recycle Bin, but it's not there. Any ideas how I can get it back?


You can't implement it retroactively, but this incident highlights the importance of version control as an industry best practice. Had you been using it already, you could simply pull the most recent version from your repository and reimplement it that way.

In terms of what you can do now, contact support and they might help you. I wouldn't hold my breath, though. It may well be out of their hands.

|improve this answer|||||
  • 1
    @raja Next to Setup in the upper right corner there should be a link for Help & Training. Note that you might not have developer support, it is a paid feature. – Adrian Larson Aug 9 '16 at 9:46

Currently, it is not possible to recover a deleted triggers or classes.

However, you can retrieve the deleted class or trigger id from workbench using the following SOQL query:

Select Id,Name from ApexTrigger where status='deleted' or name='classname'

After getting the Id, you may try to browse to the following URL: https://.salesforce.com/ to see if the code of the trigger/class is still accessible.

NOTE: If you get "Data not available", the deleted trigger/class is no longer accessible.

If you have fetched the metadata of your org then it might possible that you can retrieve the trigger code from Eclipse IDE. Just Don't refresh the metadata. Check if trigger is present then you can use the same code to re-create trigger.

|improve this answer|||||
  • OP said it's not in the Recycle Bin though. – Adrian Larson Aug 9 '16 at 9:41
  • Yes, It wont be possible to recover. It was good point to mention about version control. – Devendra Aug 9 '16 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.