You cannot recursively update or delete the same object from an Apex trigger.
This error often occurs when:
* You try to update or delete an object from within its before trigger.
* You try to delete an object from within its after trigger.
This error occurs with both direct and indirect operations. The following is an example of an indirect operation:
1. A request is submitted to update Object A.
2. A before update trigger on object A creates an object B.
3. Object A is updated.
4. An after insert trigger on object B queries object A and updates it. This is an indirect update of object A because of the before trigger of object A, so an error is generated.
* You try to update or delete an object from within its before trigger.
* You try to delete an object from within its after trigger.
This error occurs with both direct and indirect operations. The following is an example of an indirect operation:
1. A request is submitted to update Object A.
2. A before update trigger on object A creates an object B.
3. Object A is updated.
4. An after insert trigger on object B queries object A and updates it. This is an indirect update of object A because of the before trigger of object A, so an error is generated.
No comments :
Post a Comment