An Introduction to Version Control for Salesforce Flow

An Introduction to Version Control for Salesforce Flow

Last Updated on April 3, 2022 by Rakesh Gupta

Big Idea or Enduring Question:

What happens when the business requirements for a Salesforce Flow change after it’s already activated and in use?

Objectives:

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

  • Modify an existing flow to reflect new requirements
  • Clone an existing flow to create a new version 

Business Use case

Tamara McCleary is working as a System Administrator at Gurukul on Cloud (GoC). She created a Record-triggered flow that made updates to other records related to an opportunity.  This was covered in the article Update Related Quotes to Denied Except for the One That Was Accepted. Now, the Sales Manager wants the Opportunity Owner assigned a task to follow up to send the final agreement.

Automation Champion Approach (I-do):

Before discussing it, let’s discuss what is version control and why we need it. 

What is version control?

Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. 

Why does Salesforce Flow have version control?

Salesforce Flow is essentially a combination of Workflow Rules and Flow. Salesforce Flow does not allow us to modify the automation once it is activated. In order to make changes, we have to first create a new version.

You can have a maximum of 50 versions of a Flow. If you need to continue to create new versions, you will have to delete older ones.

Let’s begin building this automation process.

Guided Practice (We-do):

Once a flow gets activated it’s not possible to make any changes to it. Now we have two options that are saving existing/activated flow: 

  • A version of the current flow
  • New Flow

To solve the above business requirement, we will save the existing activated Flow as a new version. Follow the below instructions to modify the existing Flow to meet the updated business requirement.

Let’s begin building this automation process.

Guided Practice (We-do):

There are 4 steps to solve Tamara’s business requirement using Record-Triggered Flow. We must:

  1. Clone an existing flow 
  2. Add action – create a record 

Step 1: Clone an Existing Flow 

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the Flow Name that will be modified. In this case Update Related Quotes to Denied.
  4. Click on the Save As button at the top right of the Flow builder.
  5. Click Save.

Step 2: Add Action – Create a Record 

The next step is to create a new Task, for this we will use the Create Records element.

  1. On Flow Designer, below the Updated Related Quotes node, click on the +icon and select the Create Records element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Input the following information:
    1. Enter Label the API Name will auto-populate.
    2. How Many Records to Create: One
    3. How to Set the Record Fields: Use separate resources, and literal values
    4. Object: Task
    5. Set Field Values for the Opportunity
    6. Row 1:
      1. Field: OwnerId
      2. Value: {!$Record.Opportunity.OwnerId}
    7. Click Add Field
    8. Row 2:
      1. Field: Priority
      2. Value: Normal
    9. Click Add Field
    10. Row 3:
      1. Field: Status
      2. Value: Not Started
    11. Click Add Field
    12. Row 4:
      1. Field: WhatId
      2. Value: {!$Record.Id}
    13. Click Add Field
    14. Row 5:
      1. Field: Subject
      2. Value: Create & send final quote
    15. Click Add Field
    16. Row 6:
      1. Field: ActivityDate
      2. Value: {!$Flow.CurrentDate}
  4. Click Done.

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

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

Proof of Concept

Now onwards, when a business user updates the Quote Status to Accepted, the Record-triggered flow will automatically update the Quote Description and the Status on all other quotes to Denied. The record-triggered flow will also create and assign a task to the Opportunity owner. 

  1. Currently, there are three Quotes attached to Opportunity Deer Valley Corp as shown in the following screenshot
  2. Now we update the Status on Quote 1 to Accepted and click Mark as Current Status
  3. Navigate back to the Opportunity to confirm other records are changed.

Task on Quote

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? Feel free to share in the comments below.

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

Leave a Reply

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