Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

How do I check if a record of a custom object is locked through an approval process ? I know i can use the ProcessInstance to access my approval processes, but I can't check if it is locked or unlocked.

share|improve this question
    
did you look at this - salesforce.stackexchange.com/questions/30977/… ? –  crop1645 Apr 28 at 14:33
    
Yes, but I really don't like that "solution". If I want it that way, I could just check the ProcessInstance, but that have nothing to to with the actual record lock. –  David Renz Apr 28 at 14:40
    
I was thinking more about the response I made on that post (see crop1645; use a custom field) - this is how I check for locked records –  crop1645 Apr 28 at 16:16
    
    
@crop1645 After my final final accept/reject/recall the record is still locked, that's why with solution doesn't work for me. I have to check the actual lock of the record. This lock is nearly independent from the approval process. –  David Renz May 5 at 8:59

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer
1  
This is a simple click-based answer that doesn't require code. –  Mike Chale Apr 28 at 18:54
    
If a record is approved, it should be still locked and it is still locked. Is there no possibility to check this lock ? –  David Renz Apr 29 at 6:49
2  
Unfortunately, David, there is no possibility to check via Apex whether or not a record is locked. –  RobAlexander May 5 at 20:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.