Last Updated on February 10, 2022 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 8 (Auto Sync Accepted Quote with Opportunity).
Big Idea or Enduring Question:
Use multiple types of functionality to enhance the automation of your business processes.
Objectives:
After reading this blog post, the reader will be able to:
- Understand when to use before-save vs after-save record-triggered flow
- Use Flow to improve business process automation
- Use Before-save Record-Triggered Flow to create a record
- Use Before-save Record-Triggered Flow update records based on actions in a related record
Business Use case
Steve Cartwright is working as a System administrator at Universal Containers (UC). He has received a requirement from his manager to auto-update the Case Owner field with Asset’s owner if a case is created for an Asset record and anytime the Case asset field is changed.
Automation Champion Approach (I-do):
When it comes to Cases and Customer Support, organizations likely have a variety of automation that occurs. Beginning in Summer ‘20, flows are available to launch on record change. In addition to performing specific updates and actions, Salesforce Flow can initiate other Flows and Apex.
Before vs After Save Flow?
The before save flow is a trigger that is performed before an operation such as insert, update, delete. You can use such a flow to check or change values before data is updated or inserted in the database.
The after save flow is a trigger that is executed after an operation such as insert, update. You can use such a flow to update data in related objects or send an email alert.
Check out this article to understand why we are using after-save record-triggered flow for this scenario.
While this can be solved using various automation tools like Apex or Flow or Flow and Process Builder, we will use Before-save Record-Triggered Flow.
Before discussing it, 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 1 steps to solve Steve’s business requirement using Before-save Record-Triggered Flow. We must:
- Define flow properties for record-triggered flow
- Add an assignment element – update case owner
Step 1: Salesforce Flow – Define Flow Properties
As we have a requirement to update the same record which starts the flow, this is why we are suing Before save flow.
-
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows then click on the New Flow.
- Select the Record-Triggered Flow option and click on Next and configure the flow as follows:
- How do you want to start building: Freeform
- Trigger the Flow When: A record is created or Updated
- Run Flow: Before the record is saved
- Object: Case
- Select All Condition Are Met (AND).
- Set Conditions
- Row 1
- Field: Case | AssetId
- Operator: Is Null
- Value: {!$GlobalConstant.False}
- Row 1
- Choose the Option to Every time a record is updated and meets the condition requirements. (As of Winter’21 release, Flow doesn’t support ISCHANGED)
- Click Done.
Step 2: Salesforce Flow – Assignment Element – Update Case Owner
The next step is to update the Case Owner Id to the Asset Owner’s Id. For this, we will use an Assignment element. As we are using before save flow, we don’t have to explicitly use the Update Records element.
- Under Toolbox, select Element.
- Drag-and-drop Assignment element onto the Flow designer.
- Enter a name in the Label field; the API Name will auto-populate.
- Set Variable Values
- Row 1:
- Field: Case | Owner ID
- Operator: Equals
- Value: Case | Asset ID | Owner ID
- Row 1:
- Click Done.
In the end, Steve’s Flow will look like the following screenshot:
Once everything looks good, perform the steps below:
- Click Save.
- Enter Flow Label the API Name will auto-populate.
- Click Show Advanced.
- Type: Record-Triggered Flow
- API Version for Running the Flow: 50
- Interview Label: Sync Quote Automation {!$Flow.CurrentDateTime}
- Click Save.
Almost there! Once everything looks good, click the Activate button.
Proof of Concept
Now onwards, if a business creates or updates a case with an asset, Salesforce Flow will automatically Sync Case Owner from related Asset Owner.
- Make sure the Asset field is on the Case page layout and users have edit access
- The Dell PowerEdge Tower Servers Asset record is owned by Sharon User as shown in the following screenshot:
- Create a new case for the above-mentioned Asset from Brenda David’s user account, as shown in the following screenshot:
- After clicking the Save button, check the Case owner to confirm it was updated.
Independent Practice (You-do):
Create your own Flow and Process Builder to update a Case Owner to the Account Owner when the case Type* is Cancel Contract.
*you will have to modify the Type picklist on the Case object
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.
One thought on “Want the Case Owner to be the Same as Asset Owner? Here is how you can!”