We have a requirement wherein we need the approve or reject button on the a record page. The actual same button from the approval request page. So when we click the approve button on the Quote page this should show the popup modal to input a comment and finish the approval of the record. Same for the reject button. We are to put the buttons on a custom component but we aren't exactly sure how to handle the button. Is this possible?

1 Answer 1


Just found out one way to do this is through apex. On the approve or reject button handle it by calling out an apex method and the code should be like below:

Approval.ProcessWorkitemRequest approvalProcess = new Approval.ProcessWorkitemRequest();
approvalProcess.setAction(isReject ? 'Reject' : 'Approve');
approvalProcess.setNextApproverIds(new String[] { nextApproverUserId });
return Approval.process(approvalProcess)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .