You need to sign in to do that
Don't have an account?
Yao Lin
How to unlock a record right after submitted in an Approval Process?
Hi,
I need to unlock a record after it is submitted in an Approval Process for a custom object Sales Order. I tried Apex trigger, but it seems not working. Will I need an Apex Test for the trigger? If so, how can I write it? Please help!
I need to unlock a record after it is submitted in an Approval Process for a custom object Sales Order. I tried Apex trigger, but it seems not working. Will I need an Apex Test for the trigger? If so, how can I write it? Please help!
Trigger SOLockRecord on PBSI__PBSI_Sales_Order__c (after update) { For (PBSI__PBSI_Sales_Order__c so: Trigger.New){ if(Approval.isLocked(so.Id)){ Approval.unlock(so.Id); }} }
Did you try in Final approval action, make this record as unlock for editing?
Below link has working example to Lock/Unlock record thorough Apex code
http://salesforceworld4u.blogspot.com/2017/07/how-to-lockunlock-record-thorough-apex.html
Hope above information was helpful.
Please mark as Best Answer so that it can help others in the future.
Thanks,
Vinay Kumar
I need to unlock the record immediatly after users submit it for approval.
Yes, I tried the Apex Code too. It didn't work either. I don't know how to write the Apex Test code.