function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Inna ChigarevaInna Chigareva 

Apex Trigger: Auto Approval Submission

Hi, I am new to Apex coding and hope someone can help me. I need to auto submit approval for accounts if they are certain record type (01224000000Cs5a) and when Manually_passed__pc is changed to TRUE value.

Much appreciated.

Inna
RHibbsRHibbs
Hi Inna,

You actually don't need to code a trigger for this, you can automatically submit records for approval when a criteria is met using Process Builder:
If you navigate to Setup->Create->Workflow & Approval->Process Builder then you can create the process with the criteria and actions you need. You can read more in the documents here (https://help.salesforce.com/articleView?id=process_overview.htm&type=0) or better yet, take the trailhead module (https://trailhead.salesforce.com/en/modules/business_process_automation/units/process_builder)
Inna ChigarevaInna Chigareva
Hi Rory,

I tried that, but apparently it's impossible to do for Person Accounts. I need to autosubmit approval when Person account has been updated. Any ideas on how I can still acheive this?
RHibbsRHibbs
Ok, I have precious little experience with person accounts as I have never used them myself, if you are unable to use process builder to do this (I know there are certain things about person accounts that process builder can't handle) then a trigger may well be your best bet. Have you written anything so far? 
Jeff douglas has a brief blog (http://blog.jeffdouglas.com/2010/01/04/automating-salesforce-approval-processes-with-apex-triggers/) about the subject that you may want to read. Likewise, if you do have any code please post it so that we can see where you are with this.