Mass Transfer Chatter Files

Mass Transfer Chatter Files

Last Updated on February 10, 2022 by Rakesh Gupta

Big Idea or Enduring Question:

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

The file allows you to Upload, Share, Follow files in Salesforce. The file helps the organization to discuss changes to the file in real-time, from whatever device they are using. It also cuts down on email traffic and keeps all comments with the related documents for easy reference.

If a file is private, then the file owner and users with Modify All Data permission can find and view this file. However, if the file is in a private library, only the file owner has access to it. This is one pain point for System administrators how to migrate files from a user to another user because the business doesn’t want to lose all files owned by a user whom they are planning to deactivate.


This blog post will help us to understand the following

  • Use a Screen a flow to take the user input 
  • Create automation to mass transfer files
  • Learn more about the ContentDocument object. 

Business Use Case

Brenda David is working as a System administrator at Universal Containers (UC). As a part of the employee offboarding process, management wants to provide a tool to their employees so that they can easily transfer their files to another user. 

Automation Champion Approach (I-do):

There are a few possible solutions for the above business scenario, but I’ll use Screen Flow to solve the business requirement. 

Before proceeding, ahead, understanding ContentDocument objects in Salesforce. It represents a document that has been uploaded to a library in Salesforce CRM Content or Salesforce Files.
Field Name Details
OwnerId The Id of this document. 
FileType Type of document, determined by the file extension.

Before discussing the solution, 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 3 steps to solve Brenda’s business requirement using Screen Flow. We must:

  1. Create a custom field to store the user’s offboarding date 
  2. Salesforce Flow Steps: (Screen Flow)
    1. Add a screen to capture the user data
      1. Add a lookup component
    2. Add update records element to transfer file ownership 
  3. Add flow to the lightning home page 

Step 1: Creating a Few Custom Fields on the User object to Store the Offboarding Date and Offboarding Started (Formula)  

First of all, we will create the following fields on the user object to store the offboarding date and other information. We will also create a formula field to calculate when to show or hide components on the lightning home page. 

Field Name Data Type Formula
Date To Offboard Date  
Offboarding Started? Formula (Checkbox) IF(Date_To_Offboard__c >= TODAY() && NOT(ISNULL(Date_To_Offboard__c)), True, false)
  1. Click Setup.
  2. In the Object Manager, type User.
  3. Select Fields & Relationships, then click New.
  4. Select Date as Data Type, then click Next.
  5. Enter Field Label and click the tab key, the API Name will populate. 
  6. As a best practice, always input a description
  7. Set the Field-level Security for the profiles, make sure to set this field as read-write for the right people, mainly system administrators. 
  8. Add this field to Page Layout.
  9. Click Save.

Step 2.1: Salesforce Flow – Add a Screen Element 

  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. Under Toolbox, select Elements. Drag and drop Screen onto the canvas. 
  6. Input the following information:
    1. Enter Label the API Name will auto-populate.
  7. Click Done

Step 2.1.1: Add a Lookup Component to Capture the User Name To Whom They Want to Transfer Files 

  1. Under Input section on Screen Element. Drag and drop the Lookup component 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: Transfer To (Enter a label that appears next to the lookup control)
    4. Object API Name: Account ( Enter the object API name) 
    5. Required: {!$GlobalConstant.True}
  3. Click Done.

Step 2.2: Lightning Flow – Update Records – Transfer File Ownership 

The next step is to transfer the file ownership. or 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: Content Dcoument
  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: {!TransferTo.recordId}
  9. Click Done.

In the end, Brenda’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. Type: Screen Flow
  5. API Version for Running the Flow: 51
  6. Interview Label: Mass Transfer File {!$Flow.CurrentDateTime}
  7. Click Save

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

Step 3: 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 in a Lightning home page.

  1. Click Setup.
  2. In the Quick Find box, type Lightning App Builder.
  3. Select Lightning App Builder then click on the Edit next to the Home page.
  4. From the Lightning Components pane on the left, drag the Flow component onto the Lightning page canvas.
  5. Input the following information:
    1. Select Mass Transfer Files flow
    2. Click + Add Filter
    3. Set Filter Conditions
    4. Row 1:
      1. Field: User > Offbording Started
      2. Operator: Equal
      3. Value: True
  6. Click Done.

Once everything looks good, click the Save button. 

Proof of Concept

Now onwards, Sales users can this tool and transfer their files to another rep.

  1. Now, I am going to update the Date To offboard field on Nathan Gilmore’s user record.
  2. Now user Nathan Gilmore’s logged-In to his account, currently he owns three files.
  3. The next step is for Nathan to use the tool and transfers his files to Hasim Saikh.
  4. In the end, Nathan navigates backs to the File tab to verify that all his files transferred to Hasim.

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!
Preferred Timing(required)

13 thoughts on “Mass Transfer Chatter Files

  1. Hi Rakesh,
    In the above problem in step 2.1.1 you have specified Object Api Name as Account ..Why did u select Account over there?

  2. Hi Rakesh,

    First of all thanks for this post , this is very much useful.

    I have a scenario wherein i want a File owner to be able to change the ownership of only one File is this doable through flow.


  3. Pingback:bracelet réplique van cleef
  4. I would like to see if this is still validate and that there is no NEW COOL enhancements.
    I have a use case where I need to have a workflow set up to have all chatter files associated with a public chatter groups assigned to the group owners to delete where they see fit.

    1. Thanks Mark!. Yes you are right I never tried to find duplicate files but it’s a good idea. I will try it tomorrow, how you are trying to find duplicated files based on title or version ?

      1. Ooh now that I think about it, I was trying to duplicate Attachments, not Files. But if that didn’t work and I could duplicate Files, that would be a viable alternative.

        I’d be looking to duplicate all Attachments or Files associated with the source Opportunity. The Business Use Case is for opps where the salesman has procured a graphic during the sale that needs to go to the implementation team in another custom object once the opp is Closed Won.

Leave a Reply

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