You need to sign in to do that
Don't have an account?
sivapriyaa maniam sivakumar
Recall Approval Request
Hi,
We have custom button (Modify NST) in the NST Object (custom object).
Once the Approval button clicks, the status is changed to submitted.
After the Approval, Modify NST button enables. If we click the button, the recall action is taken and the record becames unlock.
ISSUE: We have an issue in recall approval process for User (other than record owner and admin).
Apex code : ApprovalRecall
My requirement is " whoever submit the approval, all user should recall the approval process.
Could you please assist me to fix this issue.
Please let me know if you need any other information.
Thanks in advance!!!
Regards
Sivapriyaa M S
We have custom button (Modify NST) in the NST Object (custom object).
Once the Approval button clicks, the status is changed to submitted.
After the Approval, Modify NST button enables. If we click the button, the recall action is taken and the record becames unlock.
ISSUE: We have an issue in recall approval process for User (other than record owner and admin).
Apex code : ApprovalRecall
global class approvalRecall { webservice static void recallApproval(Id recId) { system.debug('recId****'+recId); NST__c[] nsts = [SELECT Id,NST_Status__c from NST__c WHERE Id=:recId]; ID ObjectId=recId; List<ProcessInstance> pi = new List<ProcessInstance>([SELECT Id FROM ProcessInstance WHERE TargetObjectId =: ObjectId ]); if( (pi.size()==0)) { for(NST__c nst : nsts ) { nst.NST_Status__c='Draft'; update nst; } } else { List<ProcessInstanceWorkitem> piwi =new List<ProcessInstanceWorkitem>( [SELECT Id FROM ProcessInstanceWorkitem WHERE ProcessInstanceId=: pi[0].id]); if((piwi!=null ) && (piwi.size()>0)) { Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest(); req.setAction('Removed'); // steps to recall the approval process req.setWorkitemId(piwi.get(0).Id); Approval.process(req,false); } // Unlock the NST Approval.UnlockResult[] urList = Approval.unlock(nsts, false); for(NST__c nst : nsts ) { nst.NST_Status__c='Draft'; update nst; } }This apex class is working when the record owner and Admin clicks the "Submit for Approval" and both can view the "Recall" button and access the process. But other than record owner and admin i.e., user unable to view the recall button when the record owner or Admin clicks the "Submit for Approval".
My requirement is " whoever submit the approval, all user should recall the approval process.
Could you please assist me to fix this issue.
Please let me know if you need any other information.
Thanks in advance!!!
Regards
Sivapriyaa M S
May I suggest you please refer the below link to reference.
- https://success.salesforce.com/answers?id=9063A000000DeOnQAK
- https://success.salesforce.com/issues_view?id=a1p3A000000mAnDQAU
Hope it helps.Please mark it as best answer if the information is informative.
Thanks
Rahul Kumar
I did not find a Saleforce topic for this, but i am sure there is one.
Heres an idea from stackexchange by setting up an email service to do this as non owner.
https://salesforce.stackexchange.com/questions/122989/recall-approval-process-from-apex-for-non-admin-profile