Last Updated on December 16, 2020 by Rakesh Gupta
Big Idea or Enduring Question:
Use multiple types of functionality to enhance the automation of your business processes.
So far we had discussed Create a Record, Time-dependent action, and Update records using the Process Builder. In this article, I am going to discuss another action available in the Process Builder i.e. Flows. Process builder allows us to auto-launch a Flow.
Objectives:
After reading this blog post, the reader will be able to:
- Combine Process Builder and Flow to improve business process automation
- Use Process Builder to initiate a 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):
This approach is based on functionality available as of Spring ‘20. Beginning in Summer ‘20, flows are available to launch on record change.
When it comes to Cases and Customer Support, organizations likely have a variety of automation that occurs. To ensure updates, notifications, etc. fire in the desired order, it is recommended to use Process Builder. In addition to performing specific updates and actions, Process Builder can initiate other Processes and Flows.
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.
Guided Practice (We-do):
There are 2 steps to solve Steve’s business requirement using Flow and Process Builder. We must:
- Lightning Flow Steps:
- Define flow properties for auto-launched flow
- And add text variable to store asset owner id
- Add text variable to store case Owner id
- Add an update records element – update case owner
- Process Builder Steps:
- Define process properties
- Define evaluation criteria
- Define process criteria
- Add action – flows
Step 1.1: Lightning Flow – Define Flow Properties
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows then click on the New Flow.
- Select the Autolaunched Flow (No Trigger) option and click on Next and configure the flow as follows:
- How do you want to start building: Freeform
- Click Done.
Step 1.2: Lightning Flow – Add Text Variable to Store Asset Owner Id
- Under Toolbox, select Manager, then click New Resource to store the Asset Owner Id.
- Input the following information:
- Resource Type: Variable
- API Name: varTAssetOwnerId
- Data Type: Text
- Default Value: {!$GlobalConstant.EmptyString}
- Check Available for Input
- Check Available for Output
- Click Done.
Step 1.3: Lightning Flow – Add Text Variable to Store Case Id
- Under Toolbox, select Manager, then click New Resource to store the Case Id.
- Input the following information:
- Resource Type: Variable
- API Name: varTCaseId
- Data Type: Text
- Default Value: {!$GlobalConstant.EmptyString}
- Check Available for Input
- Check Available for Output
- Click Done.
Step 1.4: Lightning Flow – Update Records (Update Case Owner)
The next step is to update the Case Owner with the Asset Owner’s Id. For this, we will use an Update Record element.
- Under Toolbox, select Element.
- Drag-and-drop Update Records element onto the Flow designer.
- Enter a name in the Label field; the API Name will auto-populate.
- Click Specify conditions to identify records, and set fields individually
- Object: Case
- Select All Conditions Are Met (AND).
- Set Filter Conditions
- Row 1:
- Field: Id
- Operator: Equals
- Value: {!varTCaseId}
- Row 1:
- Set Field Values for the Case Records
- Row 1:
- Field: OwnerId
- Value: {!varTAssetOwnerId}
- 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.
- API Version for Running the Flow: 50
- Interview Label: Update Case Owner {!$Flow.CurrentDateTime}
- Click Save.
Almost there! Once everything looks good, click the Activate button.
Our next task is to create a Process on the Case object to Launch a Flow, only when the asset on a case is populated. To create a Process on the Case object, follow the instructions below:
Step 2.1: Define Process Properties
- Click Setup.
- In the Quick Find box, type Process Builder.
- Select Process Builder, then click New.
- Name the Process and click the Tab button. The API Name will populate.
- As a best practice, always input a description.
- The process starts when A record changes.
- Click Save.
Step 2.2: Define Evaluation Criteria
- Click on the Add Object node to begin selecting the evaluation criteria.
- Select the Case object from the dropdown list.
- Start the process when a record is created or edited.
- Click Save.
Step 2.3: Define Process Criteria
- Click the Add Criteria node to begin defining the process criteria.
- Name the criteria.
- The criteria should execute actions when the conditions are met.
- Set Conditions
- Row 1
- Field: Case | AssetId
- Operator: Is null
- Type: Boolean
- Value: False
- Row 1
- Select All of the conditions are met (AND).
- Click Advanced.
- Select Yes to execute the actions only when specified changes are made to the record.
- Click Save.
The reason why we would select the Yes checkbox for the question — Do you want to execute the actions only when specified changes are made to the record? — is to allow the Process Builder to execute the actions only if the record meets the criteria now, but the values that the record had immediately before it was saved didn’t meet the criteria. This means that these actions won’t be executed when irrelevant changes are made.
Step 2.4: Add Action – Flows
- Below Immediate Actions, click Add Action.
- For Action Type, select Flows.
- Name the action.
- Select the flow we just created – Update Case Owner.
- Set Flow Variables:
- Row 1:
- Flow Variable: varTAssetOwnerId
- Type: Field Reference
- Value: Case | Asset ID | Owner ID
- Click Add Row
- Row 2:
- Flow variable: varTCaseId
- Type: Field Reference
- Value: Case | Id
- Row 1:
- Click Save.
In the end, Steve’s Process will look like the following screenshot:
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, Process Builder 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.
16 thoughts on “Getting Started with Process Builder – Part 5 (Keep Case Owner in Sync with Asset Owner)”
Pingback: Getting Started with Salesforce Flow – Part 23 (Want the Case Owner to be the Same as Asset Owner? Here is how you can!)
Kajal
It Worked! Thank You.
Kajal
I meant to say Asset Owner field is not populating on Asset Detail Page NOT on Case Detail page.
Kajal
Hi Rakesh,
First of all thank you so much to your priceless contribution.
I have followed the steps shown above but for some reason Asset Owner field is not populating on Case Detail Page or Asset Detail Page. Any idea what went wrong?
Munira Majmundar
Was able to complete the exercise! it was my mistake. Did not correct configure Asset Owner ID. Thank you!!!
Munira Majmundar
Rakesh:
I was not able to dynamically update the Asset Owner. Will redo the steps. However, now, the Process Builder Set up has changed. Now, when one starts a Process Builder, one has to choose (The Process Starts When – Two options: 1. A Record Changes; 2. It is invoked by another process).
I chose Option 1 – A Record Changes. Could this be a reason why I was not able to dynamically change Case Owner?
Pingback: Process Builder Bulkified? Not so much… | cgarydesigns
Jarvis
my requirement here is when user view the Lead record then the Lead owner should updated with a current logged in user
Rakesh Gupta
AFAIK, it is not possible to achieve such scenarios using Process Builder.
Martin B
Also it doesn’t look like you can activate the flow unless you have set a start point in the flow (click the green arrow in the box when you hover over it
jaya koti M
Hi Rakesh,
A very big salute to your priceless contribution to the Salesforce upcoming developers.
I have been following your Process Builder tasks & implementing these in my developer org.
As part of Part 5 (Launch a Flow), I didn’t find an option to activate my Flow.
Please help me on this.
My dev org credentials:
Username : jayakoti@sforce.com Password : Welcome2dev
Rakesh Gupta
Thank you for the kind words! I am glad you have found my article helpful 🙂
Here you go
https://rakeshistom.files.wordpress.com/2015/06/activate-flow.png
Jorand
I am a little bit confused. AFAIK Asset Owner is not a standard field for Asset. Should I create an asset owner (lookup to User) as an asset custom field ?
Rakesh Gupta
I didn’t get you. Asset Owner is a standard field.
Jorand
Maybe, I have found an explanation :
As stated in the Spring 15 release notes (http://releasenotes.docs.salesforce.com/en-us/api/release-notes/rn_assets_owner_field.htm) : “Previously, assets did not have an owner field because access to asset records was based on the settings for the asset’s parent account. ”
My org was created before Spring 15, and assets ownership is controlled by parent account.
Chris
I’ve not had a great experience using Process Builder so far. Whilst it looks like it brings a lot of functionality to the table, I’ve found it to be very slow to load and complete actions whilst completing the initial setup. Do you find it to be slow too?
For the moment, I’ve just been sticking with workflow rules and flow triggers as they are faster to setup. If I have another project that I could use Process Builder for in future, then I might give it a go. It just seems like it needs a little work before it becomes properly usable..