You can manually undelete records by click Recycle Bin icon in bottom left menu. Undelete account will include contact, case, opportunity tagged to that Account. But, if you have many records or you have specific record Id or you want to undelete records with some conditions, manually delete is not an option, use Apex code for it.
You not really need to be good developer to utilize Apex code. Here we go:
1. Open Developer Console
From your name in top right, look for Developer Console
2.From Developer Console
Go to Debug menu and select Open Execute Anonymous Window
3. Enter SOQL
Example:
Account[] a = [SELECT Id FROM Account WHERE name = 'singtel' ALL ROWS];
undelete a;
Important to add ALL ROWS, otherwise deleted records will be not return on query.
4. Monitor Apex Debug Log
Go to Monitor - Logs - Debug Logs (in Salesforce menu, not Developer console)
Add user to monitor, default it will capture 20 log request for the users
5. Execute
Click Execute button in Enter Apex Code window
6. Back to Debug Log
Select latest debug log and click View to monitor
how to undelete multiple records
ReplyDeleteyou can play around with the SOQL as sample in this blog
Deletehow to undelete ALL records
ReplyDeleteHi I get this error when I try to undelete contacts:
ReplyDeleteLine: 1, Column: 1
System.DmlException: Undelete failed. First exception on row 1 with id 0034H00001pXw3lQAC; first error: DUPLICATE_VALUE, duplicate value found: TR1__External_Candidate_Id__c duplicates value on record with id: 0034L00000MhYRH: []
how can I workaround this? I have 260k contacts to restore
Thanks
can you remove Unique flag in TR1__External_Candidate_Id__c?
Delete