{"id":2392,"date":"2026-10-19T13:00:00","date_gmt":"2026-10-19T07:30:00","guid":{"rendered":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/"},"modified":"2026-11-15T11:30:08","modified_gmt":"2026-11-15T06:00:08","slug":"approval-processes-in-apex","status":"publish","type":"post","link":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/","title":{"rendered":"Approval Processes in Apex: Submit, Approve and Recall in Code"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Approval Processes in Apex let your code submit a record for approval, approve it, reject it or recall it, without anyone clicking a button. A flow can submit every overdue fee waiver at midnight, and a manager&#8217;s bulk screen can approve fifty at once. So approvals fit into automation instead of blocking it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This post builds on <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-approval-processes-guide\/\">approval processes for admins<\/a> and <a href=\"https:\/\/swapnilzambare.com\/blog\/apex-trigger-basics-context-variables\/\">Apex triggers<\/a>. We will automate fee waiver approvals at Bright Path Tutors.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What are Approval Processes in Apex?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Approval Processes in Apex are the <code>Approval<\/code> class methods that drive a standard approval process from code. The process itself is still built in Setup with its steps, approvers and final actions. Your Apex only starts it or responds to it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Think of a leave form. Setup designs the form and decides who signs it. Apex is the clerk who drops it on the right desk and collects the signature.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Approval Processes in Apex Matter<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Point and click submission works when a user clicks Submit for Approval. It falls down when the trigger is a rule, a schedule or an integration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Approval Processes in Apex cover those cases. They also let you build a bulk approval screen, because the standard interface handles one record at a time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Approval Processes in Apex Work<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You build a request object, pass it to <code>Approval.process<\/code> and read the result. Submitting also locks the record, which is often the real reason teams want it.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-diagram-1-1024x640.png\" alt=\"Approval Processes in Apex diagram showing a record moving through approval\" class=\"wp-image-2390\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-diagram-1-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-diagram-1-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-diagram-1-768x480.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">How a record moves through approval when Apex submits it.<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Submitting a Record<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();\nreq.setObjectId(waiverId);\nreq.setComments('Submitted automatically by the fee job');\nreq.setSubmitterId(UserInfo.getUserId());\nreq.setProcessDefinitionNameOrId('Fee_Waiver_Approval');\nreq.setSkipEntryCriteria(false);\n\nApproval.ProcessResult result = Approval.process(req);\nSystem.debug('Success: ' + result.isSuccess());\nSystem.debug('Status: ' + result.getInstanceStatus());<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The debug shows whether it entered the process and where it now sits.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Success: true\nStatus: Pending<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Naming the process matters when an object has several. Without it, Salesforce picks the first process whose entry criteria match.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Approving or Rejecting<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To act on a pending step you need the work item Id, which lives on <code>ProcessInstanceWorkitem<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>List&lt;ProcessInstanceWorkitem&gt; items = [\n    SELECT Id FROM ProcessInstanceWorkitem\n    WHERE ProcessInstance.TargetObjectId = :waiverId\n    LIMIT 1\n];\n\nif (!items.isEmpty()) {\n    Approval.ProcessWorkitemRequest wi = new Approval.ProcessWorkitemRequest();\n    wi.setWorkitemId(items[0].Id);\n    wi.setAction('Approve');\n    wi.setComments('Approved by the automated rule');\n    Approval.process(wi);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The action string is one of <code>Approve<\/code>, <code>Reject<\/code> or <code>Removed<\/code>. The last one recalls the submission.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Submitting Many Records<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Approval.process<\/code> accepts a List, which keeps you inside the governor limits.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>List&lt;Approval.ProcessSubmitRequest&gt; reqs = new List&lt;Approval.ProcessSubmitRequest&gt;();\nfor (Fee_Waiver__c w : waivers) {\n    Approval.ProcessSubmitRequest r = new Approval.ProcessSubmitRequest();\n    r.setObjectId(w.Id);\n    reqs.add(r);\n}\nList&lt;Approval.ProcessResult&gt; results = Approval.process(reqs, false);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The second argument is <code>allOrNone<\/code>. Passing <code>false<\/code> lets the good records through when one fails.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Approval Class Method Summary<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This table lists what each piece does.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Class or method<\/th><th>Job<\/th><\/tr><\/thead><tbody><tr><td>ProcessSubmitRequest<\/td><td>Starts an approval<\/td><\/tr><tr><td>setObjectId<\/td><td>Names the record to submit<\/td><\/tr><tr><td>setProcessDefinitionNameOrId<\/td><td>Picks which process to use<\/td><\/tr><tr><td>setNextApproverIds<\/td><td>Sets a manual approver<\/td><\/tr><tr><td>ProcessWorkitemRequest<\/td><td>Acts on a pending step<\/td><\/tr><tr><td>setAction<\/td><td>Approve, Reject or Removed<\/td><\/tr><tr><td>Approval.process<\/td><td>Runs one request or a List<\/td><\/tr><tr><td>ProcessResult<\/td><td>Holds success, status and errors<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Submit vs Work Item Requests<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These two request types confuse people. This table separates them.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Feature<\/th><th>ProcessSubmitRequest<\/th><th>ProcessWorkitemRequest<\/th><\/tr><\/thead><tbody><tr><td>Starts the process<\/td><td>Yes<\/td><td>No<\/td><\/tr><tr><td>Acts on a step<\/td><td>No<\/td><td>Yes<\/td><\/tr><tr><td>Identifier needed<\/td><td>Record Id<\/td><td>Work item Id<\/td><\/tr><tr><td>Actions allowed<\/td><td>Submit<\/td><td>Approve, Reject, Removed<\/td><\/tr><tr><td>Query needed first<\/td><td>No<\/td><td>Yes<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-diagram-2-1024x640.png\" alt=\"Approval Processes in Apex comparison of submit and work item requests\" class=\"wp-image-2391\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-diagram-2-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-diagram-2-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-diagram-2-768x480.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Submit request compared with work item request.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In short, submit starts the process and a work item request moves it along.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A Real Approval Processes in Apex Example<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Bright Path waives fees for hardship cases. Counsellors raise a waiver, and anything over 5,000 rupees must be approved by the centre head.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Submit from a Trigger Handler<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Keep the submission out of the trigger body so it stays testable.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public with sharing class WaiverApprovalService {\n    public static void submitLarge(List&lt;Fee_Waiver__c&gt; waivers) {\n        List&lt;Approval.ProcessSubmitRequest&gt; reqs = new List&lt;Approval.ProcessSubmitRequest&gt;();\n        for (Fee_Waiver__c w : waivers) {\n            if (w.Amount__c != null &amp;&amp; w.Amount__c &gt; 5000) {\n                Approval.ProcessSubmitRequest r = new Approval.ProcessSubmitRequest();\n                r.setObjectId(w.Id);\n                r.setComments('Auto submitted, amount above 5000');\n                r.setProcessDefinitionNameOrId('Fee_Waiver_Approval');\n                reqs.add(r);\n            }\n        }\n        if (reqs.isEmpty()) { return; }\n\n        List&lt;Approval.ProcessResult&gt; out = Approval.process(reqs, false);\n        for (Approval.ProcessResult res : out) {\n            if (!res.isSuccess()) {\n                System.debug('Submit failed: ' + res.getErrors()[0].getMessage());\n            }\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Check Who Must Approve<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The result tells you the next approver, which is useful for notifications.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for (Approval.ProcessResult res : out) {\n    if (res.isSuccess()) {\n        System.debug('Next approver ids: ' + res.getNewWorkitemIds());\n    }\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Test It<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Tests must create the records and then assert on the process instance.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@isTest\nprivate class WaiverApprovalServiceTest {\n    @isTest static void submitsLargeWaivers() {\n        Fee_Waiver__c w = new Fee_Waiver__c(Amount__c = 8000);\n        insert w;\n\n        Test.startTest();\n        WaiverApprovalService.submitLarge(new List&lt;Fee_Waiver__c&gt;{ w });\n        Test.stopTest();\n\n        List&lt;ProcessInstance&gt; pi = [SELECT Status FROM ProcessInstance\n                                    WHERE TargetObjectId = :w.Id];\n        System.assertEquals(1, pi.size(), 'Should have one process instance');\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These are the objects you query when checking approvals.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Object<\/th><th>Holds<\/th><\/tr><\/thead><tbody><tr><td>ProcessInstance<\/td><td>One approval run for a record<\/td><\/tr><tr><td>ProcessInstanceWorkitem<\/td><td>A pending step awaiting action<\/td><\/tr><tr><td>ProcessInstanceStep<\/td><td>A completed step with its outcome<\/td><\/tr><tr><td>ProcessInstanceHistory<\/td><td>Steps and work items together<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes with Approval Processes in Apex<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Calling Approval.process inside a loop instead of passing a List.<\/li>\n\n<li>Forgetting that submission locks the record, so later updates in the same trigger fail.<\/li>\n\n<li>Not naming the process, so the wrong one runs when several match.<\/li>\n\n<li>Assuming a work item exists without querying for it first.<\/li>\n\n<li>Submitting a record that does not meet entry criteria, which returns an error.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">The Record Lock Trap<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This one catches most people. Once a record is submitted, the platform locks it, and further updates in the same transaction throw an error. So submit after your field updates, not before.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for Approval Processes in Apex<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Build a List of requests and call process once.<\/li>\n\n<li>Always name the process definition explicitly.<\/li>\n\n<li>Pass false for allOrNone and log the failures.<\/li>\n\n<li>Submit last, after any field updates on the record.<\/li>\n\n<li>Keep the Apex thin, since the steps and approvers belong in Setup.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Practice Task<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Write a method that recalls a pending approval for a given record Id. Hint: query ProcessInstanceWorkitem and use setAction with Removed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Most Asked Approval Processes in Apex Interview Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These Approval Processes in Apex questions come up in automation interviews.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Basic Approval Processes in Apex Interview Questions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q1: Which class submits a record for approval in Apex?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Approval Processes in Apex rely on the Approval class, using ProcessSubmitRequest to start a process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q2: How do you submit a record?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Build a ProcessSubmitRequest, call setObjectId with the record Id, then pass it to Approval.process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q3: What does setComments do?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It adds the comment shown in the approval history for that submission.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q4: Which class approves a pending step?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ProcessWorkitemRequest, with setWorkitemId and setAction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q5: What are the valid action values?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Approve, Reject and Removed. Removed recalls the submission.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q6: What does Approval.process return?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A ProcessResult, or a List of them, holding success, status and any errors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q7: Does submitting lock the record?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. The platform locks it so the submitter cannot edit it while it waits.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q8: Where are the approval steps defined?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They live in Setup, not in Apex. So the code only starts or advances the process.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Intermediate Approval Processes in Apex Interview Questions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q9: How do you submit many records at once?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Build a List of ProcessSubmitRequest objects and pass the List to Approval.process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q10: What does the allOrNone parameter control?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Whether one failure blocks every submission. Passing false lets the valid ones continue.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q11: Why name the process definition?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because an object can have several processes. Without a name, the first matching one runs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q12: How do you find the pending work item?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Query ProcessInstanceWorkitem filtered by ProcessInstance.TargetObjectId.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q13: What is setNextApproverIds for?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It names the approver when the step is set to let the submitter choose manually.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q14: How do you check a record&#8217;s approval status?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Query ProcessInstance for the record and read its Status field.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q15: What happens if entry criteria do not match?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The result comes back unsuccessful with an error, and no process instance is created.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q16: Can Apex release the record lock?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. The Approval class has lock and matching release methods that take a record or an Id.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Advanced Approval Processes in Apex Interview Questions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q17: Scenario: a trigger submits then updates the record and fails. Why?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Submission locked the record, so the later update is blocked. Move the submit to the end, or release the lock first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q18: How would you build a bulk approval screen?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Query the pending work items for the user, then build a List of ProcessWorkitemRequest objects and process them in one call.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q19: How do you test approvals without a real approver?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create the test user, assign the right role, then query the work item and approve it inside the test.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q20: Scenario: approvals must be triggered by an integration. What do you build?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An Apex REST service or invocable method that validates the record and calls Approval.process, with proper error handling.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q21: What are the governor limits here?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Approval.process counts as DML, so the usual 150 DML statements per transaction apply. Bulk calls keep you safe.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q22: How do you report on approval history?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Query ProcessInstanceStep and ProcessInstanceHistory, or build a report on the process instance objects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q23: Why keep approval logic in Setup rather than Apex?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because admins can change approvers and steps without a deployment, which is the point of the declarative tool.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q24: Can Flow replace Approval Processes in Apex?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Flow Approvals cover many cases now with no code. So reach for Apex only when the trigger or volume needs it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q25: Do Approval Processes in Apex fire validation rules?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Field updates in the final actions run the normal save path. So validation rules can fire and block the approval.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q26: Can you submit a record twice?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Not while one approval is pending. So check ProcessInstance first, or handle the error that comes back.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q27: How do Approval Processes in Apex behave in a test class?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They run normally, so the process instance is created. However, the approver must exist and meet the step rules.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q28: What is the difference between an approval and a simple status field?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An approval keeps a signed history and locks the record. A status field does neither, so audits are much weaker.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q29: Scenario: approvers change every quarter. Where do you handle it?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In Setup, by editing the process or using a queue. Keeping names out of Apex means no deployment is needed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.apexref.meta\/apexref\/apex_class_Approval.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Apex Reference: Approval Class<\/a><\/li>\n\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.apexcode.meta\/apexcode\/apex_approval_processing_intro.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Apex Developer Guide: Approval Processing<\/a><\/li>\n\n<li><a href=\"https:\/\/help.salesforce.com\/s\/articleView?id=sf.what_are_approvals.htm&amp;type=5\" target=\"_blank\" rel=\"noopener noreferrer\">Salesforce Help: Approval Processes<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Approval Processes in Apex drive a Setup process from code.<\/li>\n\n<li>ProcessSubmitRequest starts it, ProcessWorkitemRequest advances it.<\/li>\n\n<li>Submission locks the record, so submit after your updates.<\/li>\n\n<li>Pass Lists and allOrNone false for bulk safety.<\/li>\n\n<li>Steps and approvers stay in Setup, not in Apex.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we read org settings from code with <a href=\"https:\/\/swapnilzambare.com\/blog\/hierarchy-custom-settings-apex\/\">Hierarchy Custom Settings in Apex<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Approval Processes in Apex let your code submit a record for approval, approve it, reject it or recall it, without anyone clicking a button.&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2389,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[239,8,96],"tags":[68,98,11],"swapz_series":[],"class_list":["post-2392","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apex-fundamentals","category-salesforce","category-salesforce-developer","tag-advanced","tag-apex","tag-flows"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Approval Processes in Apex with Code Examples<\/title>\n<meta name=\"description\" content=\"Learn Approval Processes in Apex: submit for approval, approve, reject and recall with the Approval class, bulk submits and top interview questions.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Approval Processes in Apex with Code Examples\" \/>\n<meta property=\"og:description\" content=\"Learn Approval Processes in Apex: submit for approval, approve, reject and recall with the Approval class, bulk submits and top interview questions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/\" \/>\n<meta property=\"og:site_name\" content=\"Swapnil Zambare - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-19T07:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-15T06:00:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Swapnil Zambare\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Swapnil Zambare\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/\"},\"author\":{\"name\":\"Swapnil Zambare\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/10b09224c8bcc562716e86789427592a\"},\"headline\":\"Approval Processes in Apex: Submit, Approve and Recall in Code\",\"datePublished\":\"2026-10-19T07:30:00+00:00\",\"dateModified\":\"2026-11-15T06:00:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/\"},\"wordCount\":1583,\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/approval-processes-in-apex-featured.png\",\"keywords\":[\"Advanced\",\"Apex\",\"Flows\"],\"articleSection\":[\"Apex Fundamentals\",\"Salesforce\",\"Salesforce Developer\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/\",\"name\":\"Approval Processes in Apex with Code Examples\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/approval-processes-in-apex-featured.png\",\"datePublished\":\"2026-10-19T07:30:00+00:00\",\"dateModified\":\"2026-11-15T06:00:08+00:00\",\"description\":\"Learn Approval Processes in Apex: submit for approval, approve, reject and recall with the Approval class, bulk submits and top interview questions.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/#primaryimage\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/approval-processes-in-apex-featured.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/approval-processes-in-apex-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Approval Processes in Apex featured image: code editor card with submit request\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/approval-processes-in-apex\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Approval Processes in Apex: Submit, Approve and Recall in Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"name\":\"Swapnil Zambare - Blog\",\"description\":\"Salesforce &amp; Tech Guides\",\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\",\"name\":\"Swapnil Zambare - Blog\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"width\":512,\"height\":512,\"caption\":\"Swapnil Zambare - Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/theSwapnilZambare\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/10b09224c8bcc562716e86789427592a\",\"name\":\"Swapnil Zambare\",\"sameAs\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\"],\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/author\\\/swapnil-zambare\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Approval Processes in Apex with Code Examples","description":"Learn Approval Processes in Apex: submit for approval, approve, reject and recall with the Approval class, bulk submits and top interview questions.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/","og_locale":"en_US","og_type":"article","og_title":"Approval Processes in Apex with Code Examples","og_description":"Learn Approval Processes in Apex: submit for approval, approve, reject and recall with the Approval class, bulk submits and top interview questions.","og_url":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/","og_site_name":"Swapnil Zambare - Blog","article_published_time":"2026-10-19T07:30:00+00:00","article_modified_time":"2026-11-15T06:00:08+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-featured.png","type":"image\/png"}],"author":"Swapnil Zambare","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Swapnil Zambare","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/#article","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/"},"author":{"name":"Swapnil Zambare","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/10b09224c8bcc562716e86789427592a"},"headline":"Approval Processes in Apex: Submit, Approve and Recall in Code","datePublished":"2026-10-19T07:30:00+00:00","dateModified":"2026-11-15T06:00:08+00:00","mainEntityOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/"},"wordCount":1583,"publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-featured.png","keywords":["Advanced","Apex","Flows"],"articleSection":["Apex Fundamentals","Salesforce","Salesforce Developer"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/","url":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/","name":"Approval Processes in Apex with Code Examples","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/#primaryimage"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-featured.png","datePublished":"2026-10-19T07:30:00+00:00","dateModified":"2026-11-15T06:00:08+00:00","description":"Learn Approval Processes in Apex: submit for approval, approve, reject and recall with the Approval class, bulk submits and top interview questions.","breadcrumb":{"@id":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/#primaryimage","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-featured.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/approval-processes-in-apex-featured.png","width":2400,"height":1260,"caption":"Approval Processes in Apex featured image: code editor card with submit request"},{"@type":"BreadcrumbList","@id":"https:\/\/swapnilzambare.com\/blog\/approval-processes-in-apex\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/swapnilzambare.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Approval Processes in Apex: Submit, Approve and Recall in Code"}]},{"@type":"WebSite","@id":"https:\/\/swapnilzambare.com\/blog\/#website","url":"https:\/\/swapnilzambare.com\/blog\/","name":"Swapnil Zambare - Blog","description":"Salesforce &amp; Tech Guides","publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/swapnilzambare.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/swapnilzambare.com\/blog\/#organization","name":"Swapnil Zambare - Blog","url":"https:\/\/swapnilzambare.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","width":512,"height":512,"caption":"Swapnil Zambare - Blog"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/in\/theSwapnilZambare"]},{"@type":"Person","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/10b09224c8bcc562716e86789427592a","name":"Swapnil Zambare","sameAs":["https:\/\/swapnilzambare.com\/blog"],"url":"https:\/\/swapnilzambare.com\/blog\/author\/swapnil-zambare\/"}]}},"_links":{"self":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/2392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/comments?post=2392"}],"version-history":[{"count":1,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/2392\/revisions"}],"predecessor-version":[{"id":3055,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/2392\/revisions\/3055"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media\/2389"}],"wp:attachment":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media?parent=2392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/categories?post=2392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/tags?post=2392"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=2392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}