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
RobbiePRobbieP 

Submit for Approval through Flow

How do I in effect click the 'Submit for Approval' button on a case from a script?

Chris JohnChris John

If you feel comfortable writing some Apex code, you could write a small class that creates the approval process, which you could call from the Flow using the Apex callout element.

 

E.g.

Apex Class: 'SubmitForApprovalPlugin' implementing the Process.Plugin interface

Flow calls 'SubmitForApprovalPlugin' using an Apex callout.

inputs to apex class (as a value table):

* Id (of the record to submit for approval)

* Comments (comments for the approval request)

outputs to Flow (as a value table):

* Success status (boolean)

 

References:

Developing an Approval Process in Apex: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process_example.htm

Implementing the Process.Plugin Interface: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process_plugin.htm

Designer user guide (there's a section for the Apex Callout element): http://www.salesforce.com/us/developer/docs/firefly/salesforce_flow_designer.pdf

 

Let me know if you have any questions, hope that helps!