Prevent an Apex Trigger from running twice

Recently I encountered an issue where I needed to stop a trigger from running twice.
For instance if you are making an update in a trigger that uses the Trigger.isUpdate context.
In this scenario if we make an update inside the Trigger.isUpdate context it will loop forever and error out.

Here is how to solve for that:

 

 

Add Comment