function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gary PayneGary Payne 

What field designates a record as "Locked"?

When a record becomes "Locked" as a result of being submitted for approval, is there a field that designates the record's locked condition?  We need to create a report for identifying records as not having been submitted for approval yet.  A custom object, "NBR" is created when an Opportunity Stage is "Closed Won" and saved.  The user must edit the new NBR record in a least 3 required fields then save and then submit for approval. We want to develop a report to list the NBR records that have been created but not yet submitted for approval.  My thought was to create a checkbox field on the NBR object called "Submitted for Approval" and update it via workflow after the NBR was submitted for approval.
NagaNaga (Salesforce Developers) 
Dear Gary,

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!

Please let me know if this helps.

Best Regards
Naga kiran