Skip to main content

Hi Everyone, 

 

I’m working on a scenario where an Opportunity trigger updates the related Account

, and an Account trigger in turn performs some additional updates. 

 

What would be the best approach to prevent trigger recursion

while keeping the solution bulkified and scalable? Would a static variable-based approach be sufficient, or is there a better Trigger Handler pattern for managing this? 

 

Looking forward to your recommendations and real-time implementation approaches. 

 

Thanks!  

 

#Salesforce  #Salesforce Developer  #Apex  #Trailhead

2 个回答
  1. Manoj Nambirajan (Dell Technologies) Forum Ambassador
    8月31日 12:09

    @Deepak Sharma

    Trigger Handler with proper control on execution context will help. 

    You can also have a metadata table maintained where in you define threshold for trigger recursion. 

     

    also.. help check below links for references 

     

    https://www.youtube.com/watch?v=tWICYv5t5G0

     

    https://www.youtube.com/watch?v=-oZ4hXNKrdw

0/9000