You need to sign in to do that
Don't have an account?
Tashika Gupta
how to check the record is undeleted from recycle bin
i have a custom checkbox feild called recovered on account.Whenver the record is recovered from recycle bin i want that the recovered feild should be checked.
I want to implement this through trigger. how can i do this ???
I want to implement this through trigger. how can i do this ???
When you undelete the records, they will be like all other normal records and no way to identify if it's undeleted.
Trigger:
trigger undlttrgracc on account(after undelete) {
list<account> undeltedacc=new list<account>();
for (account ld: trigger.new) {
account acc = new account();
acc.id=ld.id;
acc.Recoverd__c=true; //recovered is checkbox
undeltedacc.add(acc);
}
update undeltedacc;
}
However you can check the Undelete() api call.
https://www.salesforce.com/developer/docs/api/Content/sforce_api_calls_undelete.htm
Thanks,
Pratik
All Answers
When you undelete the records, they will be like all other normal records and no way to identify if it's undeleted.
Trigger:
trigger undlttrgracc on account(after undelete) {
list<account> undeltedacc=new list<account>();
for (account ld: trigger.new) {
account acc = new account();
acc.id=ld.id;
acc.Recoverd__c=true; //recovered is checkbox
undeltedacc.add(acc);
}
update undeltedacc;
}
However you can check the Undelete() api call.
https://www.salesforce.com/developer/docs/api/Content/sforce_api_calls_undelete.htm
Thanks,
Pratik
Create after undelete trigger, use below sample code to update the field you want:
Regards,
Axaykumar
Thanks,
Axaykumar