7

All events are having before and after events, but why is there no before-undelete event in Salesforce triggers?

4 Answers 4

9

Because, there will be no record available before Undelete to update. But After Undelete you will be having a record to update something with that record.

5

There is a record, it has the field isDeleted set to True. Standard security means that these records are not visible, either via the UI or Apex, so an undelete trigger wouldn't be able to see the records that it needs.

0

Undelete means..already a record is deleted from Salesforce DB/System and trying to get that deleted record back to Salesforce Db/System.SO the record which is already deleted is not in the Scope of SalesForce System and it will be in Recycle_Bin(Out of Salesforce System Scope)..So there is no "Before Undelete" Event in SalesForce.

0

The undelete operation creates a new Id for the restored record. Allowing the before event means that changes can be made to the record before it is put back into the database, which is the same as doing an insert operation since a new Id is created. To keep the authenticity of the data by guaranteeing that what goes to the recycle garbage can is exactly what is received during the restoration, the before event has been removed for undelete. This way we can guarantee the reliability of the data coming from the recycle garbage can and make a clear difference between the undelete and insert operations.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .