Activity Forums Salesforce® Discussions Why we used handler class in trigger in Salesforce?

  • MOHIT

    Member
    February 6, 2020 at 2:31 pm

    we used handler class in trigger in Salesforce because it:

    facilitates logic-less triggers and One Trigger Per Object, which itself has many benefits(including fine grained control over order of execution)
    improves readability and Separation of Concerns(this improved readability makes version control more fruitful as well)
    optionally facilitates selective disablement

  • Anjali

    Member
    February 6, 2020 at 2:38 pm

    It is best practise to write one trigger per Object and process all handler in apex class that is Handler, instead of writing logic in trigger.

  • Ratnesh

    Member
    February 6, 2020 at 2:41 pm

    Trigger handler is the starting point to 'handle' complex logic set into a trigger.

    Creating a class defined as MyObjectTriggerHandler can help to design a modular set of reusable objects which manage all the operations to be done by a trigger.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos