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.
Guided Practice (We-do):
There are 4 steps to solve Tamara’s business requirement using Record-Triggered Flow. We must:
- Clone an existing flow
- Add action – create a record
Step 1: Clone an Existing Flow
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows then click on the Flow Name that will be modified. In this case Update Related Quotes to Denied.
- Click on the Save As button at the top right of the Flow builder.
- 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.
- On Flow Designer, below the Updated Related Quotes node, click on the +icon and select the Create Records element.
- Enter a name in the Label field; the API Name will auto-populate.
- Input the following information:
- Enter Label the API Name will auto-populate.
- How Many Records to Create: One
- How to Set the Record Fields: Use separate resources, and literal values
- Object: Task
- Set Field Values for the Opportunity
- Row 1:
- Field: OwnerId
- Value: {!$Record.Opportunity.OwnerId}
- Click Add Field
- Row 2:
- Field: Priority
- Value: Normal
- Click Add Field
- Row 3:
- Field: Status
- Value: Not Started
- Click Add Field
- Row 4:
- Field: WhatId
- Value: {!$Record.Id}
- Click Add Field
- Row 5:
- Field: Subject
- Value: Create & send final quote
- Click Add Field
- Row 6:
- Field: ActivityDate
- Value: {!$Flow.CurrentDate}
- 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.
- Currently, there are three Quotes attached to Opportunity Deer Valley Corp as shown in the following screenshot
- Now we update the Status on Quote 1 to Accepted and click Mark as Current Status
- 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.