Start Autolaunched Flow Approvals From A Button

Salesforce Flow Approval Process revamp was a success. When I look at all the interest I see from the ecosystem, there is a significant number of automation experts experimenting with this feature, and building approvals.

The new approval process is built on Orchestration, and it is free. There are two types of approval processes you can create:

  • Record-Triggered
  • Autolaunched

I covered the record-triggered use case with the recent Supercharge Your Approvals with Salesforce Flow Approval Processes post. Let me give you another use case where the user can start an autolaunched approval process from a button. I have incorporated the answers to a few questions I recently received into this build.

🚨 Use case 👇🏼

Escalate a case to a queue of level 2 experts when a second opinion is required.

Start Flows and Orchestrations From a Button

The most popular method for launching Salesforce automations from a button is by using the quick action button. You can create a quick action for a flow and assign that to a button on the lightning record page layout. There are certain requirements for this solution to work:
  • Quick actions can only be used to add an active screen flow to the page layout. Remember that you are not required to add a screen element to your flow, but your flow has to be saved and activated as a screen flow. Orchestrations are not supported.
  • The record Id of the current record on the screen will be automatically passed to the recordId variable. The variable name in the screen flow has to follow this exact syntax.
  • You can not pass additional input parameter values into your automation.

When you build autolaunched approval process, you build autolaunched automation that can be executed on demand. This is very similar to the autolaunched Orchestration or flow. Although this autolaunched automation can and will have UI components like approval evaluation step screen flows, they can not be called from a quick action button.

As a result, we will build an autolaunched Approval Orchestration and assign it to a button using the URL method. I will explain how we will do that after we complete the build.

Build an Approval Screen Flow From The Template

Evaluate Approval Screen Flow Canvas

Use the Approvals Workflow: Evaluate Approval Requests template to build your screen flow. When sent to approval, your case will show this screen flow as a work guide item on the lightning page layout.

  1. Create New Flow.
  2. Choose Template.
  3. Pick the Approvals Workflow: Evaluate Approval Requests template.
  4. Make cosmetic modifications and save your flow and activate it. You can also add additional inputs and screens for your users to submit data, if you need that.

Evaluate Approval Flow Screen

Please note that this template includes all the required variables with the required syntax: approvalDecision and approvalComments. You can build your own screen flow without starting from a template, but then you will have to make sure you complete this required step manually.

Build an Autolaunched Approval Orchestration (No Trigger)

Now that you built the required screen flow, you can build your approval orchestration that will call this screen flow.

For this example, create a queue called Level2 for cases. Add yourself to the queue and assign an email address to the queue that you use for testing purposes.

  1. Create New Flow.
  2. Choose From Scratch.
  3. Choose Autolaunched Approval Orchestration (No Trigger) from the list of boxes you see on the screen.
  4. Add a stage. You don’t need to configure the start element for this type of Orchestration.
  5. Add a step. Point it to the screen flow you have saved and activated.
  6. Scope the approval to the Case recordId. This is where the work guide item will appear for the approvers.
  7. Assign the approval to the queue you created (Level2). Lock the record for all, do not customize the email.
  8. Save and activate your approval orchestration.

Autolaunched Approval Orchestration

Configure the URL Custom Button

Go to your all flows list view and choose View Details and Versions under the list view line item chevron menu on the right side. Grab the URL for your Orchestration. It should look like this (depends on your naming): /flow/Case_XPR_Approval_AL_Orchestration

Use the required syntax to add the URL for the approval orchestration to the button. Here is the syntax for my orchestration (view the Salesforce documentation here):

/flow/Case_XPR_Approval_AL_Orchestration?recordId={!Case.Id}&submitter={!$User.Id}&retURL={!Case.Id}

Note that the first part is the URL you just grabbed, and the following parts are the input parameter values for the orchestration. The last parameter directs the screen to the case when the automation is completed.

Case Approval Custom Button URL Syntax

Follow these steps to add this button to the case record page:

  1. Go to Setup > Object Manager > Case > Buttons, Links, and Actions and add a New Button or Link
  2. Give your button a label (I will call it Case Approval button here), make it a Detail Page Button, display it in existing window (one of the choices), and choose URL.
  3. Paste the URL you built for your approval orchestration into the URL window and check the syntax. Save it.
  4. Go to page layouts under the Object Manager, and add the custom button to the page layout in use.
  5. Go to the lightning page layout editor for the layout in use and add the Case Approval custom button there. Save and activate (no need if it is active) the page layout.

Case Page Layout Approval Custom Button

Add the Flow Orchestration Work Guide Component

While you are on the lightning page layout editor, add the Flow Orchestration Work Guide component to the case lightning page layout. It works well on the top of the right column. Save your page layout. This component will show the work guide item to the users when the approval step is assigned to them. I recommend you choose to hide the component when there is to work guide item assigned to the user.

Case Page Layout Work Guide and Approval Trace

Add the Approval Trace Component

The related lists for legacy approvals won’t show the flow orchestration approval progress for the record. You need to add the Approval Trace component to the page layout for that. Edit the page layout for case, and drag the Approval Trace component to your case lightning page layout. I recommend you create an additional tab for this and add the component there.

Remember that you can see all the approval process information for all your records on the Approvals Lightning App.

Approval Trace Tab

Activating Email Response Approvals

To allow users to approve or reject an approval process step via email, enable the appropriate feature. You can do this by activating the “Enable email approval response” checkbox found in the Process Automation settings under Setup.
This is the email user will receive when the response approvals are enabled.
Approval Queue User Email with Reply to Approve
This is the email that the queue email address receives when the record is sent to approval.
Approval Queue Standard Email

Watch the Video for a Full Tutorial

Watch this video to learn how I built an Autolaunched Flow Approval Orchestration and assign it to a button on the Lightning Record Page. This solution shows how you can use queues to assign your approval step. In addition, you can see what email notifications are being sent for approvals, and how approval email responses can be leveraged to complete the approval step.

Explore related content:

Can You Start With a Loop Inside Your Schedule-Triggered Flow?

Keep Salesforce Data Clean With Before Save Flows

Transform Element Now Supports Join Collections

Tom Bassett’s YouTube Channel

Andy Engin Utkan

Andy Engin Utkan is a Salesforce MVP with 24 certifications. He is the founder of Salesforce Consulting Partner BRDPro Consulting. Utkan is a consultant, trainer, and content creator, focusing on automating business processes using Salesforce flow. He is recognized for his expertise in Salesforce flow, providing guidance through various courses and contributing actively to the Salesforce community.

7 Comments

  1. Hi Andy,

    I’ve been trying to get hands-on experience with the Flow Approval process, but I’m currently facing an issue with the email notifications. I’ve followed all the necessary prerequisites to configure email notifications, but they still aren’t working for me.

    I also reviewed your videos on the Flow Approval process for reference.

    Here are the steps I’ve completed so far as part of notification configuration:

    Created the queue as per the documented steps

    Added the queue email address

    Despite this, I’m still not receiving the email notifications. Could you please help me troubleshoot this issue?

    Looking forward to your support.

    Thanks

  2. Hey Andy,
    How does the recall path work in the orchestration flow? Do we need to create an autolaunched flow to handle the recall or does the Recall button in the Approval Submission object handle it?
    Thanks

    1. There are two ways you can recall: 1) When you view your own approval submissions in the Approvals app in a list view, you can go to the chevron menu on the right side on the row item, and recall there. 2) Recall flow action. You can use the recall flow action to tie this to a button on the record page. When you recall, the recall path elements and actions will be performed.

Leave a Reply

Back to top button

Discover more from Salesforce Break

Subscribe now to keep reading and get access to the full archive.

Continue reading