+ Start a Discussion
prathap cprathap c 

when we will use after undelete in trigger.new?

hi guys, please explain about afeter undelete

when we will use after undelete in trigger.new?
Best Answer chosen by prathap c
KaranrajKaranraj
Undelete operation in trigger will fired, if you are restoring deleted record from the recycle bin. Example. If you deleted an account record, then it will be moved to recycle bin,if you restore the deleted account record from recycle bin, then undelete event in account object will get triggered.

Trigger.New will holds the new value of the record, you can't use trigger.old in after undelete trigger event. To get more details, please check this link https://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_triggers_recovered_records.htm|StartTopic=Content%2Fapex_triggers_recovered_records.htm|SkinName=webhelp

All Answers

Anoop yadavAnoop yadav
Hi,
When you restore the record from Recycle Bin.
Check the below link.
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008wWXIAY
KaranrajKaranraj
Undelete operation in trigger will fired, if you are restoring deleted record from the recycle bin. Example. If you deleted an account record, then it will be moved to recycle bin,if you restore the deleted account record from recycle bin, then undelete event in account object will get triggered.

Trigger.New will holds the new value of the record, you can't use trigger.old in after undelete trigger event. To get more details, please check this link https://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_triggers_recovered_records.htm|StartTopic=Content%2Fapex_triggers_recovered_records.htm|SkinName=webhelp
This was selected as the best answer