How to check if a record is locked through an approval process?

You could create an "In Approval Process?" checkbox and set it to true in the Initial Submission Actions and then set it to false in the Final Approval, Rejection, and Recall Actions of approval processes.


SF has added isLocked method in System.Approval class from Spring 16 (Api level 36). So it is now possible to check if the record is locked or unlocked using Apex.

Additionally, SF has also added the ability to lock/unlock the record using Apex code. Please refer to same document. Basically, the code would look like

Approval.isLocked(recordId);
     or
Approval.isLocked(recordIds);

Check https://developer.salesforce.com/docs/atlas.en-us.200.0.apexcode.meta/apexcode/apex_methods_system_approval.htm#apex_System_approval_isLocked for more info