Chatter File allows you to Upload, Share, Follow files in the cloud. Chatter 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. You will get access to only those files that you own or have got access (because someone shared with you). There is no way to access someone (Other users) personal files (If it’s not shared with you) whether you are a System administrator or top of Role Hierarchy. This is one pain point for System administrator how to migrate Chatter files from one user to another user because sometimes business doesn’t want to lose all Chatter files owned by some user whom they are planning to derivative for some reason.
Business Use case
Universal Container is using Salesforce Chatter File and wants to provide an easier way to their users so they can mass transfer file ownership with another user.
Solution for the above business requirement
I am back with a simple example to start with Visual Workflow. We will create an app using Flow to fire this flow will use Custom Link. Before proceeding you have to understand ContentDocument objects in Salesforce. It represents a document that has been uploaded to a library in Salesforce CRM Content or a file in Chatter.
To develop this application follow the below instructions
1) Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2) Click on New Flow, it will open flow canvas for you. Create One Text type variable UserID (To pass LoggedIn user id) as shown in the below screenshot
3) Drag and drop a Screen ( Give the name Transfer Chatter Files) on the window, add two fields with below details
Name | Data Type | Required |
Transfer From | Display Text | No, This field is used to display loggedIn UserID |
Transfer To | Textbox | Yes, Pass user ID whom you want to transfer Chatter Files |
It will look like the below screenshot
In this app, user have to enter a User ID in Transfer To field. In case if you want to enter Name and then wants to display corresponding users in this case you have to add one more screen and use Dynamic Choice.
4) Drag and drop a Record Update ( Give the name Move Chatter Files) onto the window to move Chatter files to another user and map the fields according to below details
- Select Object ContentDocument
- OwnerId= {!UserID} [ This is nothing but LoggedIn user ID], and updated OwnerId with Screen input {!Transfer_To}. You can take help from the below screenshot
Finally our Flow will look like the following screenshot
5) Save the flow with name Transfer Chatter Files and close the canvas.
Add Visual workflow into the home page component
We can call Flow from custom button, link, sub-flow, Visualforce page , Apex start() or using Flow Trigger workflow action. Here we will call our flow using Custom Link available in the homepage component. To do that follow below instruction
1) Create custom link from Name | Setup | App Setup | Customize | Home | Custom link
2) Add custom link in the Home page component
3) Add Home page component into the Home page layout
It’s time to test this feature
1) In this demo I will be transferring Chatter Files from user “Demo User” to the user “Rakesh Gupta“, as a first step copy the ID of the user “Rakesh Gupta” and loggedIn as Demo User.
2) To open this app click on “Transfer Chatter Files” link available on the homepage, and fill the details you can take help from below screenshot
3) Click on Next button and you are done. Now navigate to Files | Files I Own and you can see there are no files left. Below is the proof of concept
You can add remove fields according to your business needs. I will suggest you to Implement this first on your developer org test it and then move it to Production. Let me know if you have any difficulty to Implement it.