Getting Started with Salesforce Flow – Part 31 (Auto Submit Record into Approval Process with Flow)

Getting Started with Salesforce Flow – Part 31 (Auto Submit Record into Approval Process with Flow)

Last Updated on January 4, 2021 by Rakesh Gupta

To understand how to solve the same business use case using Process Builder and Salesforce Flow. Check out this article Getting Started with Process Builder – Part 25 (Auto Submit Record into Approval Process).

Big Idea or Enduring Question:

How do you automatically submit a record for approval using Salesforce Flow?

Objectives:

After reading this article, you’ll be able to:

  • Use After-save Record-Triggered Flow to automatically submit the record into the approval
  • How to create an Approval process 

Business Use case

Warren Mason is working as a System Administrator at Universal Containers (UC). He has created an approval process on the Campaign object. This will work only for those campaigns where the Budgeted Cost is greater than $1M. Now he is looking for a way so that the campaign record will be automatically submitted into the approval process without any manual intervention when it meets the entry criteria.

Automation Champion Approach (I-do):

An approval process is an automated process an organization can use to approve records in Salesforce. To submit a record into the approval process, the user has to manually click on the Submit For Approval button, as shown in the screenshot below.
 
 
The disadvantage of this manual process is that a user can forget to click on the Submit For Approval button. It will not auto-send records into the approval process, and therefore, it may cause an issue sometimes. In this article, I am going to discuss how you can use Process Builder to automate this process. While this can be solved using various automation tools like Process Builder, Apex Trigger, or Flow, we will use After-save Record-Triggered Flow. Check out this article to understand why we are using after-save record-triggered flow for this scenario. 
 
Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes to go through the following Flow diagram and understand it.

Let’s begin building this automation process.

Guided Practice (We-do):

There are 2 steps to solve Warren’s business requirement using Salesforce Flow. We must:

  1. Create an approval process 
  2. Salesforce Flow
    1. Define flow properties for record-triggered flow and check the budget 
    2. Use action to submit the record to the approval process 

Step 1: Create an Approval Process 

  1. Click Setup.
  2. In the Quick Find box, type Approval Processes.
  3. Clicks on the Create New Approval Process | Use Standard Setup Wizard button. 
  4. Select the Campaign object for Manage Approval Processes For drop-down. 
  5. Now create an approval process, as shown in the following screenshot:

Step 2.1: Salesforce Flow – Define Flow Properties 

As we have a requirement for submitting the record into the approval process, this is why we have to use the After-save flow. 

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. Select the Record-Triggered Flow option and click on Next and configure the flow as follows: 
    1. How do you want to start building: Freeform
    2. Trigger the Flow When: A record is created or updated
    3. Run Flow: After the record is saved
  5. Object: Campaign
  6. Select All Condition Are Met (AND)
  7. Set Conditions
    1. Row 1
      1. Field: Campaign | IsActive
      2. Operator: Equals
      3. Value: {!$GlobalConstant.True}
    2. Click Add Condition
    3. Row 2
      1. Field: Campaign | Budgeted Cost in Campaign
      2. Operator: Greater Than
      3. Value: 1000000
  8. Select Only when a record is updated to meet the condition requirements.
  9. Click Done.

Step 2.2: Salesforce Flow – Call an Acton – Submit Record for Approval 

The next step is to submit the campaign record for approval. For this, we will call the SUbmit for Approval core action.

  1. Under Toolbox, select Element
  2. Drag-and-drop Action element onto the Flow designer. 
  3. In the Action box, type Submit for Approval.
  4. Clicks on the Submit for Approval Core action.
  5. Set Input Values:
    1. Record ID: {!$Record.Id}
    2. Approval Process Name Or ID: Campaign_budget_greater_than_1M
    3. Submission Comments: Auto Submitted through Flow
  6. Click Done.

In the end, Warren’s Flow will look like the following screenshot:

  1. Click Save.
  2. Enter Flow Label the API Name will auto-populate.
  3. Click Show Advanced.
  4. Type: Record-Triggered Flow
  5. API Version for Running the Flow: 51
  6. Interview Label: Submit campaign for Approval {!$Flow.CurrentDateTime}
  7. Click Save

Almost there! Once everything looks good, click the Activate button.

A few key details to remember

  1. When defining the Approval Steps, if you have selected Let the submitter choose the approver manually option (Step 3: Select Assigned Approver ), then Process Builder will not work. You will get a runtime error (i.e., No applicable approval process found).
  2. The record is submitted to the default approval process, and there are no active approval processes for the record’s object type.
  3. The record is submitted to the default approval process, and it doesn’t meet the criteria for any of the approval processes for the record’s object type.
  4. The record is submitted to a specific approval process, and it doesn’t meet the entry criteria.

Proof of Concept

Now onwards, if a business user creates a campaign with a budget amount greater than $1M and makes it active, then Salesforce Flow will automatically trigger and submit the record for the approval process. 

Formative Assessment:

I want to hear from you!  

What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? 

Let me know by Tweeting me at @automationchamp, or find me on LinkedIn.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

52 thoughts on “Getting Started with Salesforce Flow – Part 31 (Auto Submit Record into Approval Process with Flow)

  1. Any chance we can make requests to see you do this with the new lightning flow? I would like to kick off a flow to determine which approval process it enters based off of profiles and criteria. I am a little lost and know that this is a great solution if I could just get it right one time.

  2. Hi Rakesh,

    This is really great and you made it easy.

    However i get an error message on the record and it says: “The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 30128000000JTrS. Contact your administrator for help.”

    When i tried to search something on this error – i found that this is a known issue. Is that so? If so, any alternate solution for this?

    Thanks for your help!!!

  3. Hello sir..
    thanks for this article. it’s really helpful. but i am not getting “flow trigger” action in workflow rule.will you please tell me how can i do that. from where to contact salesforce to enable this for me.

  4. Hi Rakesh,
    This is a wonderful tutorial! It has helped me immensely! I built out this flow and approval process but each time I save a new Opportunity I get the message “Wrokflow Action Failed to Trigger Flow. The record couldn’t be saved because it failed to trigger a flow…”

  5. Hi Rakesh,

    Thank you for the great tutorial.

    Just wondering though if it is also possible to view the Submit for Approval button for the ServiceDesk Staff or it just available for the Admin?

    Looking forward for your response! 🙂

    Thank you in advance! 🙂

  6. Hi Rakesh,
    We have used the auto submit for several months now and it works fine, except when the second approver has rejected the request…… When the project is rejected, edited and saved again, we would like to have it auto submitted again. At this moment we have to click the button “submit for approval”.
    Could you please advice me?

      1. Hi, That’s exactly what I ment.
        Rejected, and after that auto submit. At the moment we have to click the button ” submit for approval”.

  7. To call a Flow from Process Builder, please follow the below instructions
    1) Navigate to Setup | Build | Create | Workflow & Approvals | Process Builder and click on the New button to create new Process
    2) Enter the Process Name, Description and API Name, Once done click on Save button as shown in the following screenshot
    https://rakeshistom.files.wordpress.com/2015/02/prcoess-builder.png
    3) Now Click on Object then Select the Opportunity Object and Evaluation Criteria for Process, as shown in the following screenshot
    https://rakeshistom.files.wordpress.com/2015/02/add-evaluation-criteria.png
    Once done click on Save button
    4) Next step is to add Process Criteria, To do that Click on Add Criteria, Please refer to the following screenshot for more details
    https://rakeshistom.files.wordpress.com/2015/02/process-criteria1.png
    Once done click on Save button.
    5) Next task is to add one Immediate Actions i.e. Launch a Flow, Please refer to the following screenshot for more details
    https://rakeshistom.files.wordpress.com/2015/02/add-immediate-actions.png
    Once done click on Save button.
    6) Finally your Process will look like the following screenshot
    https://rakeshistom.files.wordpress.com/2015/02/auto-submit-into-approval.png
    7) Activate the Process. After you activate a process, you can no longer edit that process

  8. Hi Rakesh,
    Thanks a lot for the post.

    I am also getting the same error mentioned above by Carola.
    ‘When I click on “run” it says “your flow doesn’t have a start element”
    Please suggest me what to do.

      1. Thanks a lot Rakesh.

        You mentioned about one error in consideration.
        In my approval step, approvers are added automatically (two static users). But still am getting same error when the entry criteria or process step criteria does not meet.
        Can you please help.

  9. I don’t have the ability to use flow with an immediate WorkFlow action. Flows has been enabled for my sandbox org. What could I be doing wrong? Are there any input/output definitions I need to set on the Flow canvas?

  10. Hi,

    Am using a Developer org and it is upgraded to Winter 15. But I don’t see the option “New Flow Trigger” under “Workflow and Approval Process”, although able to create the Flows.

    Can you help me with information on enabling it on Dev org. Thanks

      1. Thanks Rakesh for your response.

        I understand we have a AE for non-Dev orgs. For the Dev orgs, whom should we reach out to? Is there any support site where we request the feature to be enabled to?

        Thansk again. – Manju

  11. I don’t have the ability to use flow with an immediate WorkFlow action. Is there another option to call the flow?

    -WorkFlow action using the outbound message?
    -Custom button using the flow url?

    Outbound message seems like it would be my preference.

    Thanks,

    Jay

    1. To enable this feature (call Flow through WFR) you have to raise a case with Salesforce.com support. Meanwhile there are other ways to call the Flow is using custom button, custom url or through VF pages.

  12. Hi rakesh,
    Thanks, I saw that in a earlier comment of yours, so I’ve done that already.
    Still I don’t see the fields to select name and value ( I see them in your second screen).

      1. I’m one step further. Created the workflow, activated it, but i receive an erro:
        workflow action failed etc.
        So I went to check out the flow and whe n I click on “run” it says “your flow doesn’t have a start element.

        I can’t insert print screens in this comment field. I have put them into a word doc, but I don’t see anything to upload them…do yoy have an email address?

  13. Hi Rakesh,
    I was very happy to read your blog, because it can save my collegues thousands of mouseclicks.
    I want to use it for submitting our custom object “project”, after it has been edited and saved, automatically into the approval process.
    When I create a workflow I don’t have the option to select “new flow trigger”.
    Could you please help me with that?
    I’m testing in our sandbox, which is already at Winter’15
    Hope you can help me out.
    Thanks,
    Carola

      1. Hi Rakesh,
        Salesforce has enabled this feature in my org. That’s really great, but still I’m doning someting wrong.
        I have made the flow, with the variable which I have created. Does the variable need to be input, output or input/output? Does it have a defalut value or just blank?

        After that I have made a workflow. At the step “immediate workflow actions” I’m able to select “new flow trigger” but I dont’ see the field where you can set the flow variable…..

        Or do I have to choose for excisting action? but then I can’t choose a flow trigger.

        Many many thanks for you help.

  14. Hi Rakesh,
    I am trying to create a flow to automatically submit a Contract record into the approval process. I got added to the pilot program and the static action is there. However I dont have the option to set the flow variables in my workflow trigger. I am not sure if I created the flow correctly. In the above blog you say to ‘Create One text type variable RecordID (to pass a record ID from workflow via Flow Trigger).’ Can you provide the exact steps to do that as I might not be doing that correctly.
    Thanks,
    Kristen

  15. I see that you can add an approval element in Flow in the coming Winter ’15 release. Is the workflow immediate action to run a flow also available in Winter ’15? I don’t see that option in my Workflows.

  16. HI Rakesh,

    Could please share the video of this tutorial ? I dont see static action for Submit For Approval in Flow .
    It would be great help if you like to share further on this . Thanks in advace.

    Abrar.

  17. Hi Rakesh,

    Thank you for all your great tutorial and effort to share with us. I am not able to follow this as screen shot, can you make video tut for this plz.

      1. That’ll be awesome, you should make quick steps video for all your posts as you already have the detail explanation in the post. Is there anyway to contact you personally.?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.