Activity Forums Salesforce® Discussions What is Utility Class in Salesforce and Why it is used?

  • Deepak

    Member
    February 24, 2020 at 10:19 am

    Hi Pooja,

    Utility classes are helper classes that consisits of reusable methods. From triggers we can call methods in such public classes. This helps to reduce code with in trigger and make it more structured.

    The purpose of a utility class is to serve as a single one-stop-shop for reusable pieces of code. Basically any variable, method, inner class and whatever it might be that is used multiple times across multiple other classes within the project, can reside into a single (or multiple) utility class or classes, which helps writing more elegant and structured code, as well as makes the code easier to maintain.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos