Activity Forums Salesforce® Discussions Can a trigger have a static keyword in its code in Salesforce?

  • Deepak

    Member
    February 11, 2020 at 5:56 am

    Hi Mohit,

    We can declare and use static variables in a trigger, but we cannot use static initializer blocks.

    A static variable defined in a trigger doesn't retain its value between different trigger contexts within the same transaction, such as between before insert and after insert invocations.

    Hope it helps!

  • Anjali

    Member
    February 11, 2020 at 2:30 pm

    A trigger cannot have a static keyword in its code.

  • Pooja

    Member
    February 11, 2020 at 2:47 pm

    A trigger can not have a static keyword in its code in Salesforce.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos