In this article of our Chatter Bot series, Zach Boyd and I wanted a declarative way to take actions when new versions of Chatter Files were uploaded. We had the business requirement to notify a team of people in real-time when updates were occurring.

As standard feature, anyone who follows a Chatter File receives notice in their daily digest of which records or files have been updated, but that notification only occurs once per day and doesn’t include the reason for change when the new file version was uploaded.

chatter-file-digest-email

At the time of this writing, Process Builder does not support ContentDocument, ContentVersion, or ContentNote objects. The lack of support for these objects makes using Process Builder a bit difficult so we developed Chatter Bot for Files to make this possible.

You can support our cause by voting for the following on the IdeaExchange:

Introducing Chatter Bot for Files

Chatter Bot for Files is a way to easily listen for version changes to Chatter Files and take action. An example would be to automatically notify each user following a File that a new version has been uploaded. This solution, available on GitHub, makes it easy by monitoring for updates on ContentVersion object and then updating a custom object that you can leverage within Process Builder.

Getting Started

  1. Deploy the code from GitHub
  2. Assign Chatter Bot Files Admin permission set to your admin user
  3. Switch to Chatter Bot Files app
  4. Click on Chatter Bot File tab and click New button. Enter the ID of a Chatter File into the Content Document ID field then click Save button.
  5. Upload a new version of the file to Salesforce then navigate back to your Chatter Bot File record to see that it has been updated with current version details.

chatter_bot_files_app1

chatter_file_id[1].png

create_chatter_bot_file[1].png

upload_new_file_version[1].png

updated_chatter_bot_file[1].png

Notify Followers of New File Versions

The solution on GitHub comes bundled with an example Process Builder and Flow that demonstrate how to notify a file’s followers any time a new version is uploaded. The email content is defined by the Chatter Bot File Template email template in the Chatter Bot Email Templates folder.

Chatter File Followers.png

chatter-bot-file-email

If you prefer for this not to happen then you can either uncheck the Active checkbox (Chatter_Bot_File__c.Active__c) or deactive/delete the example process/flow.

The process and flow names are, respectively:

  • Chatter Bot – Notify Followers of File Change
  • Chatter Bot – Notify Followers of File Change Flow

Note that for this specific use case we had to develop some Invocable Apex classes that Flow could run to (1) get list of email addresses of the file’s followers and (2) send email alert with custom options like whether to attach the file to the outgoing email or not.

Notify File Followers Flow.png