Getting Started with Process Builder – Part 5 (Keep Case Owner in Sync with Asset Owner)

Getting Started with Process Builder – Part 5 (Keep Case Owner in Sync with Asset Owner)

Last Updated on July 14, 2021 by Rakesh Gupta

To understand how to solve the same business use case using Salesforce Flow. Check out this article Getting Started with Salesforce Flow – Part 23 (Want the Case Owner to be the Same as Asset Owner? Here is how you can!).

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.

Let’s begin building this automation process.

Guided Practice (We-do):

There are 2 steps to solve Steve’s business requirement using Flow and Process Builder. We must: 

  1. Lightning Flow Steps:
    1. Define flow properties for auto-launched flow
    2. And add text variable to store asset owner id
    3. Add text variable to store case Owner id
    4. Add an update records element  – update case owner
  2. Process Builder Steps:
    1. Define process properties
    2. Define evaluation criteria
    3. Define process criteria
    4. Add action – flows 

Step 1.1: Lightning Flow – Define Flow Properties 

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. Select the Autolaunched Flow (No Trigger) option and click on Next and configure the flow as follows: 
    1. How do you want to start building: Freeform
  5. Click Done.

Step 1.2: Lightning Flow – Add Text Variable to Store Asset Owner Id

  1. Under Toolbox, select Manager, then click New Resource to store the Asset Owner Id.
  2. Input the following information: 
    1. Resource Type: Variable
    2. API Name: varTAssetOwnerId
    3. Data Type: Text
    4. Default Value: {!$GlobalConstant.EmptyString}
    5. Check Available for Input
    6. Check Available for Output
  3. Click Done.

Step 1.3: Lightning Flow – Add Text Variable to Store Case Id

  1. Under Toolbox, select Manager, then click New Resource to store the Case Id.
  2. Input the following information: 
    1. Resource Type: Variable
    2. API Name: varTCaseId
    3. Data Type: Text
    4. Default Value: {!$GlobalConstant.EmptyString}
    5. Check Available for Input
    6. Check Available for Output
  3. 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.

  1. Under Toolbox, select Element
  2. Drag-and-drop Update Records element onto the Flow designer. 
  3. Enter a name in the Label field; the API Name will auto-populate.
  4. Click Specify conditions to identify records, and set fields individually
  5. Object: Case
  6. Select All Conditions Are Met (AND)
  7. Set Filter Conditions
    1. Row 1:
      1. Field: Id
      2. Operator: Equals
      3. Value: {!varTCaseId}
  8. Set Field Values for the Case Records
    1. Row 1:
      1. Field: OwnerId
      2. Value: {!varTAssetOwnerId}
  9. Click Done.

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

Once everything looks good, perform the steps below: 

  1. Click Save.
  2. Enter Flow Label the API Name will auto-populate.
  3. Click Show Advanced.
  4. API Version for Running the Flow: 50
  5. Interview Label: Update Case Owner {!$Flow.CurrentDateTime}
  6. 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

  1. Click Setup.
  2. In the Quick Find box, type Process Builder.
  3. Select Process Builder, then click New.
  4. Name the Process and click the Tab button. The API Name will populate. 
  5. As a best practice, always input a description
  6. The process starts when A record changes.
  7. Click Save.

Step 2.2: Define Evaluation Criteria

  1. Click on the Add Object node to begin selecting the evaluation criteria.
  2. Select the Case object from the dropdown list.
  3. Start the process when a record is created or edited.
  4. Click Save.

Step 2.3: Define Process Criteria

  1. Click the Add Criteria node to begin defining the process criteria.
  2. Name the criteria.
  3. The criteria should execute actions when the conditions are met.
  4. Set Conditions
    1. Row 1
      1. Field: Case | AssetId
      2. Operator: Is null
      3. Type: Boolean
      4. Value: False
  5. Select All of the conditions are met (AND)
  6. Click Advanced
  7. Select Yes to execute the actions only when specified changes are made to the record.
  8. 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

  1. Below Immediate Actions, click Add Action.
  2. For Action Type, select Flows
  3. Name the action.
  4. Select the flow we just createdUpdate Case Owner.
  5. Set Flow Variables: 
    1. Row 1:
      1. Flow Variable: varTAssetOwnerId
      2. Type: Field Reference
      3. Value: Case | Asset ID | Owner ID
    2. Click Add Row
    3. Row 2:
      1. Flow variable: varTCaseId
      2. Type: Field Reference
      3. Value: Case | Id
  6. 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.

  1. Make sure the Asset field is on the Case page layout and users have edit access
  2. The Dell PowerEdge Tower Servers Asset record is owned by Sharon User as shown in the following screenshot:
  3. Create a new case for the above-mentioned Asset from Brenda David’s user account, as shown in the following screenshot:
  4. 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.

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

16 thoughts on “Getting Started with Process Builder – Part 5 (Keep Case Owner in Sync with Asset Owner)

  1. 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?

  2. 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?

  3. 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

  4. 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

  5. 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 ?

  6. 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..

Leave a Reply

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