You need to sign in to do that
Don't have an account?
VSK98
After Undelete Trigger
Hi,
I have written the sample trigger on case object. But getting the error is Read Only Error
The code is below
Any suggestions
Adv Thnx
VSK
I have written the sample trigger on case object. But getting the error is Read Only Error
The code is below
trigger caserecundel on Case (after undelete) { if( trigger.isundelete){ system.debug('Entering in the undelete*****'); for(case c : trigger.new){ system.debug('Entering in the Loop*****'); c.After_Undelete__c = true; undelete c; } } }
Any suggestions
Adv Thnx
VSK
I think you'll need to select the un-deleted records with a SOQL, then change all of the After_Undelete__c flags to true, then do an update on them.
Could you explain cleary bcz i am new to work on this
Adv Thnx,
VSK
Nthng here jst update the undelete record .....
i did mistake Update C;
Regards,
VSK
So, you see - the trigger is firing AFTER the case has been un-deleted. By that time - you can not do anything with the buffer record. So, you need to re-aquire the records that were un-deleted. (remember a trigger can be call with a list of upto 200 records).
So the SOQL get's the records that were just un-deleted, and the you loop through those records and update the After_Undelete__c field, and then update the list of re-aquired records.
Hope that helps