How to approve and reject the record in apex class?

How to approve and reject the record in apex class?

Go through the URL. http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process_example.htm You will find your answer there. The problem with that example is that is shows how it’s done if the program is going to create and approve the process in one fell swoop. It doesn’t show how to find a process that’s pending and approve it.

How to automatically submit request for approval using APEX?

Automatically submit the approval process using trigger – Apex: Below method is used to automatically submit the approval process using trigger. view source print? 2 3 5 req1.setComments (‘Submitting request for approval automatically using Trigger’);

Is there a submit for approval, approve and reject button?

I have custom Submit For Approval, Approve and Reject Buttons on the record detail page. I have created a Approval Process .I want to call this Approval Process to execute upon clicking custom ‘Submit for Approval’ Button.This I am able to acheive by following code.

How to automate the approval process in Salesforce?

API of Approval Process classes: Steps of Standard approval process defined: To achieve this, I am going to create the trigger named “AutomateApprove”. Automatically submit the approval process using trigger – Apex: Below method is used to automatically submit the approval process using trigger.

How to create test class for approval process?

In your test class, you need to create a Quote. And then u need to submit your Quote record for approval using apex. refer: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_process_example.htm. Post that, call your method “removeQuoteFromApproval” and your test class shall work.

Is it possible to put logic inside a method in apex?

Closed 3 years ago. You need to put the logic inside the method. You can not put the logic directly in the class. Try below code Not the answer you’re looking for? Browse other questions tagged apex or ask your own question.