• #66866
    Salesforce | Anuj Anuj #8

    How To Avoid Recursive Trigger in Apex in Salesforce?

    How To Avoid Recursive Trigger in Apex?


    Salesforce | Ratnesh Ratnesh #9

    Recursion occurs when same code is executed again and again. It can lead to infinite loop and which can result to governor limit sometime. To avoid the situation of recursive call, we have to write code in such a way that the trigger will execute one time. To do so, we can create a class with a static Boolean variable with default value true

    Salesforce | Aditya Aditya #15

    recursive trigger occurs when code is executed again and again and exceeds CPU time. To avoid it create a class with a static Boolean variable which return true or false value by default it return true value:

    public Class checkRecursive{
    private static boolean run = true;
    public static boolean runOnce(){
    return true;



    return run;


Viewing 3 posts - 1 through 3 (of 3 total)

Please to reply to this topic.

Popular Salesforce Videos


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2020 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?