7

I don't see a way to unlock a record that is locked by approval process.IsLocked flag is not accessible through api.Is there any way to do this.

11

As of Winter '16, this is now possible through APEX. (Release Notes)

It can be enabled by going to Setup > Create > Workflow & Approvals > Process Automation Settings :

enter image description here

7

EDITOR NOTE

As mentioned in other answers, this feature is now possible out of the box as of Winter '16.

Original Answer

not out of the box.

What we did in a client project was:

  1. Create RecordLockStatus__c picklist field with valuess [UNLOCKED, IN_APPROVAL, LOCKED]
  2. Create UnlockToken__c text field
  3. Create an approval process with entry criteria RecordLockStatus__c='LOCKED' and UnlockToken__c = ?SEMI_SECRET_TOKEN? to prevent accidental unlock and sets RecordLockStatus__c='UNLOCKED' and UnlockToken__c=NULL. Make sure to set the approval's order to 1.
  4. For all your other approvals make sure that you set RecordLockStatus__c= 'IN_APPROVAL' when entering the approval and RecordLockStatus__c='LOCKED' when locking the record on finish
  5. To unlock your record query it (make sure RecordLockStatus__c='LOCKED') and submit for approval using Apex http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_process.htm

hope that helps

1

Apex doesn't expose any class/method to unlock a record. There are only two ways a record can be unlocked that is locked by the approval process.

  • The 'Final Approval Action' of the process does have the feature to unlock a record.
  • A button labelled 'Unlock record' will be visible (only)to system administrators and only they can unlock a record locked by an approval process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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