Submit for Approval is the final post in the series. I truly hope you've found this unique approach helpful in tearing down the fear of Lightning Flow. Record-Trigger Flows are the simplest way to learn flows. I hope you've subscribed to both this blog and my YouTube channel as I continue to provide little 'tidbits' to help you on your Salesforce journey.
We'll be focusing on how we submit a record for approval. Before we begin, an Approval Process needs to have previously been created.
Our use case for this example will be around an Account custom field called Active. This field has picklist values of Yes and No. Our requirement calls for us to send the record for review, or "approval", whenever the Active is set to No.
In Process Builder, we'd set up our Decision based on the above rule, then we'd add a New Immediate Action. Decisions were covered back in the second post in this series. Once we've clicked the Add Action link, we're prompted to select the Action Type called Submit for Approval.
A series of new fields appear and we give the Action a Name. In the Approval Process picklist, we'll select a Specific Approval Process and use the lookup field to find our pre-created Approval Process. There are a couple of additional options we can select for more control over the Approval Process but for our use case, we'll use their default values. Click the Save button and we're done.
Approval Processes impact other objects so we're again going to use the After Record-Trigger Flow. We're again going to use the Action Element. Yes, this is the third time we've gone to the Action element to do stuff. If you get bored, just explore all the fun little things you can do with an Action element.
In the Action search field, start typing Approval and select the Submit for Approval option when it appears. Doing this will open the screen up, just like when we selected Submit for Approval in Process Builder.
Flow likes to use the word Label instead of Name but it's the same thing so type in a name for the action.
We need to tell the flow the Record ID we want to submit so we'll use our friend $Record and select the Id field.
The final step is to select the Approval Process we want to run. Click on the Approval Process Name or ID toggle. This will enable the field so we can put a value in it. Unlike Process Builder where our field was a nice lookup field that works, Flow's is a lookup field but only looks up items within the Flow. That's not what we want so, in another browser tab, go to Setup and navigate to Approval Processes. Click into the approval process we're using so you're seeing all its detail. Find the field labeled Unique Name. Copy that and paste it into the Approval Process Name or ID field in Flow.
Click the Done button to close the element. Yes, there are a bunch of additional parameters (ie: fields) we can enable and use, but just like in Process Builder, just cause they are there, doesn't mean we have to use them.
Save the Flow and test it out. There you have it! You're now able to build a Submit for Approval element in Flow.
I've mentioned this in a few of the posts in this series but it bears repeating. Once you learn to use the Elements in a Record Trigger Flows, you can apply that knowledge to all the other types of Flow. Just as After Record-Trigger Flows have more Elements than the Before Flow, an Autolaunched Flow has more than the After Flow, and a Screen Flow has even more. Repeating, the good news is the Elements you've learned in this series DO NOT change when using them in the other types of Flows. Don't be afraid.
While I'm repeating myself, let me again ask you to please subscribe to both this blog and to my YouTube channel. It has been a lot of fun putting this series together for you.
If you'd like me to present this series at your local User Group meeting, please reach out. I'd love to share it with your group.