Hi, To undelete an account record, you can do a SOQL query to get the deleted records like this: Account DeletedAccount=[select id from contact where name='YOUR_ACCOUNT_NAME ' limit 1 ALL ROWS ];
Then you can use 'undelete' operation to undelete that record: Undelete DeletedAccount;
Please note that the code structure of the trigger will depend on what functionality are you trying to achieve.
Hi, To undelete an account record, you can do a SOQL query to get the deleted records like this: Account DeletedAccount=[select id from contact where name='YOUR_ACCOUNT_NAME ' limit 1 ALL ROWS ];
Then you can use 'undelete' operation to undelete that record: Undelete DeletedAccount;
Please note that the code structure of the trigger will depend on what functionality are you trying to achieve.
As I can see Narender is using account object to get records but in the query and he is using Contact object. The error he will get is invalid type Account. I don't think it works. Please review the code.
To undelete an account record, you can do a SOQL query to get the deleted records like this:
Account DeletedAccount=[select id from contact where name='YOUR_ACCOUNT_NAME ' limit 1 ALL ROWS ];
Then you can use 'undelete' operation to undelete that record:
Undelete DeletedAccount;
Please note that the code structure of the trigger will depend on what functionality are you trying to achieve.
All Answers
To undelete an account record, you can do a SOQL query to get the deleted records like this:
Account DeletedAccount=[select id from contact where name='YOUR_ACCOUNT_NAME ' limit 1 ALL ROWS ];
Then you can use 'undelete' operation to undelete that record:
Undelete DeletedAccount;
Please note that the code structure of the trigger will depend on what functionality are you trying to achieve.
As I can see Narender is using account object to get records but in the query and he is using Contact object.
The error he will get is invalid type Account.
I don't think it works. Please review the code.
Thank You
Ajay Dubedi
The query should be:
Account DeletedAccount=[select id from account where name='YOUR_ACCOUNT_NAME ' limit 1 ALL ROWS ];
Thanks Ajay for pointing it out!