Posts tagged ‘Approval Process’

Trigger to Automatically Submit Record for Approval

Use Case:

You want all new records for an object to be submitted to an Approval Process, but you do not want to rely on users to manually click the ‘Submit for Approval’ button after creating the record.


After creating and testing a new Approval Process (Setup / App Setup / Create / Workflow & Approvals / Approval Processes), implement this simple Apex Trigger (the following example is for the Account object). You will also need to create a test method to ensure code coverage if your current production Apex Classes do not provide adequate coverage. Developers may also want to add try / catch statements to ensure that exceptions are caught and handled properly.