Activity Forums Salesforce® Discussions Can trigger is able to modify the record locked by the approval process in Salesforce?

  • PRANAV

    Member
    September 23, 2016 at 6:05 am

    Hi Mohit,

    If you have your code written directly in the trigger or in a class designated without sharing, then the apex code can update records that are locked, regardless of the user who caused the trigger to fire.

    If you use code in a class marked with sharing that is called by the trigger, then you will get an exception. If the trigger was executed by an Administrator, then the code will always run.

    Hope this helps you.

    Thanks

  • Tanu

    Member
    September 23, 2016 at 6:08 am

    Hello Mohit,
    It's depends on your code.

    If you have your code written directly in the trigger or in a class designated without sharing, then the apex code can update records that are locked, regardless of the user who caused the trigger to fire. I tested by creating a trigger on Contact that updates a field on the Contact's Account. When the Account is locked, I can edit the contact record with a non admin user and the field on the Account gets updated.

    If you use code in a class marked with sharing that is called by the trigger, then you will get an exception. If the trigger was executed by an Administrator, then the code will always run.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos