Getting Started with Salesforce Flow – Part 63 (Allow Users to Mass Transfer Records They Own)

Getting Started with Salesforce Flow – Part 63 (Allow Users to Mass Transfer Records They Own)

Big Idea or Enduring Question:

How do you allow Sales reps an easy to transfer their opportunities to another user?

In today’s world, Sales reps switch their job frequently. Transferring their existing or closed deals or leads to another user is time-consuming work. Salesforce provides various ways to change the Ownership of records from one user to another. But it has some limitations: 

  • Salesforce doesn’t provide a way to transfer records Ownership using Salesforce mobile app.
  • Changing the record’s owner from the user interface doesn’t provide a way to transfer all child records.
    • For example, it doesn’t allow you to change the related Orders owner when you change the opportunity owner. 
  • Mass Transfer Chatter Files

This article will show you how you can develop your own tool for transfer Ownership and work on the Salesforce mobile app.

Objectives:

This blog post will help us to understand the following

  • Use a Screen a flow to take the user input to update records
  • Learn how to use the Update Records element to create multiple records

Business Use Case

Brenda David is working as a System Administrator at Universal Containers (UC). She has received a requirement from the management to create a wizard which allows their users to mass transfer opportunity record ownership from one user to another user. 

Automation Champion Approach (I-do):

There are multiple ways to solve the above business requirement. You can either use Lightning Web Component, Salesforce Flow, and more. To solve this requirement, we will use the Screen Flow.   

Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes going through the following Flow diagram and understand it. Let’s begin building this automation process.

Guided Practice (We-do):

There are 4 steps to solve Brenda’s business requirement using Screen Flow. We must

  1. Salesforce Flow Steps: Define flow properties 
  2. Add a screen to capture the user’s input
    1. Add a lookup component to display all Users 
  3. Add an Update Records element to update the opportunities owner 
  4. Add flow to the lightning home page 

Step 1: Salesforce 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 Screen Flow option and click on Next and configure the flow as follows: 
    1. How do you want to start building: Freeform
  5. It will open the flow designer for you.

Step 2: Salesforce Flow – Add a Screen Element

  1. Under Toolbox, select Elements. Drag and drop Screen onto the canvas. 
  2. Input the following information:
    1. Enter Label the API Name will auto-populate.
  3. Click Done

Step 2.1: Salesforce Flow – Add a Lookup Component to Display All Users

It’s time to add a Lookup Component to capture the new owner for opportunities. For this, we will use the lookup component.

    1. Under Input section on Screen Element. Drag and drop Lookup onto the screen. 
    2. Input the following information:
      1. Enter API Name.
      2. Field API Name: CreatedById (Enter the field API Name that will show up in the list box to represent a record.)
      3. Label: New Owner (Enter a label that appears next to the lookup control)
      4. Object API NameOpportunity ( Enter the object API name) 
      5. Required: {!$GlobalConstant.True}
    3. Click Done.

 

Step 3: Lightning Flow – Add an Update Records Element to Update the Opportunities Owner

The next step is to mass update the opportunities owned by the logged_In user to the new owner.  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: Opportunity
  6. Select All Conditions Are Met (AND)
  7. Set Filter Conditions
    1. Row 1:
      1. Field: OwnerId
      2. Operator: Equals
      3. Value: {!$User.Id}
  8. Set Field Values for the Case Records
    1. Row 1:
      1. Field: OwnerId
      2. Value: {!New_Owner.recordId}
  9. Click Done.


In the end, Brenda’s Flow will look like the following screenshot (I turned on Auto-Layout) for this flow: 


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. How to Run the Flow: User or System Context—Depends on How Flow is Launched
  5. Type: Screen Flow
  6. API Version for Running the Flow: 52
  7. Interview Label: Screen Flow: Mass Transfer Owner {!$Flow.CurrentDateTime}
  8. Click Save.  


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

Step 4: Add a Flow to Lightning Home Page and Add Filter Criteria 

The next step is to distribute a flow to Lightning Experience or Salesforce app users by embedding it on a Lightning home page.

  1. In the Quick Find box, type Lightning App Builder.
  2. Select Lightning App Builder then click on the Edit next to the Home page.
  3. From the Lightning Components pane on the left, drag the Flow component onto the Lightning page canvas.
  4. Input the following information:
    1. Select Screen Flow: Mass Transfer Owner flow
    2. Layout: One Column 
  5. Click Done.
  6. Once everything looks good, click the Save button. 

Proof of Concept

Now Onwards, anyone can use this application to mass transfer their opportunities to another rep. 

Formative Assessment:

I want to hear from you!  

What did you learn from this post, is it relevant to you, and how will you modify the concepts taught in the post for your own business processes?  

Make a post and tag me on Twitter @automationchamp using #AutomationChampionFlow.

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

17 thoughts on “Getting Started with Salesforce Flow – Part 63 (Allow Users to Mass Transfer Records They Own)

  1. Hi Rakesh,

    Thanks for this post as it helps to mass transfer the Account Owner but after the transfer of Owner , iam unable to change the Accounts to another owner or to the previous owner . It’s not changing the Account ownership and can you tell me where i am going wrong.

  2. Hi, first thanks a lot for your blog it is very interesting and useful.

    A question about this flow, how much records can it handle without hiting the Executed elements at runtime per flow limit of 2000 ?
    Would il be possible to move a part of it to an apex class to avoid this limit ?

    Thanks for your help !

  3. Thanks Rakesh. As a workaround to display multiple fields, I created a formula field like “Name : <> ; Status : <> ; Created by : <>” and used this field in the Multi Select Checkbox field. Though it helps solve the purpose,I have an issue in the way the field gets displayed. As the length of the field is high, the field value gets displayed in two lines ( although there are spaces to the right of the page). Is there any way we can control this setting?

  4. Great blog Rakesh. My question – Is it possible to list down all the records of the old owner and select the ones to be transferred to the new owner? Thanks

      1. Thanks Rakesh. I was able to display the list of records using Dynamic Checkbox option. However, just wondering if I could show multiple fields of the records (may be in the form of a table) rather than just name or a single field. This way, it would be easier for the user to select the exact records.

  5. This was a great posting. I want to change owner on a Lead with Salesforce1. I was able to follow all your instructions up until where i needed to create a Lead Action to launch the flow, and I couldn’t find a way. All your SF1 examples are for new tabs in SF1. Is there a way to have similar functionality in SF1 than you can with a custom URL Button on the detail record?

Leave a Reply

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