Activity Forums Salesforce® Discussions How to check if a record is locked or not in Apex during an approval process?

  • Ajit

    Member
    April 30, 2016 at 6:18 pm

    I believe it's possible to query for the existence of an Approval Request related to your record, I believe this is via: ProcessInstance. Try checking out:https://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_process_example.htm|StartTopic=Content%2Fapex_process_example.htm|SkinName=webhelp

    Additionally, you could write a method to attempt to update the record, and trap the exception message that comes from the record being locked and hide the buttons based on that result!

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos