Salesforce File Attached
This event is published when a file is uploaded to Salesforce (as a ContentDocument)and Linked to a Salesforce Object Record (as a ContentDocumentLink), through "Files" or "Notes & Attachments" section.
This event is not published when a file is uploaded into Salesforce as the old standard Attachment format.
This event should not be confused with File Uploaded, which is published when a file is uploaded to external storage through the CloudFiles widget.
To use CloudFiles Platform Events, you must first setup your platform event triggered flow as shown in the CloudFiles Event Handler Flow Template. This article will introduce you to the concepts of the event type in the CloudFiles Event Object as well as event details that are returned by the Get Event Details flow action.
Once you are familiar with these, you will understand how to interpret & use these as illustrated in the sections below.
Please use salesforce-file-attached as the type filter when selecting this event in the decision element in flow builder.
The corresponding Get Event Details flow action returns the Salesforce Files Details sub-type with useful information including files, content document Ids, parent Id and parent type. Refer to the image below for a list of outputs and descriptions of the parameters returned in this sub-type.
- Parent Id - Id of the Salesforce record where the file is uploaded
- Parent Type - Type of the Salesforce record where the file is uploaded. Example - Account
- ContentDocumentIds - A list of ContentDocumentId. When multiple files are uploaded together, only one instance of this event is published holding all the uploaded file ids as ContentDocumentIds
Here are a few use-cases for this platform event.
- Copy the salesforce file auto-attached by external tools such as document generation apps to external storage folders & sub-folders as soon as they are uploaded to save on Salesforce storage and provide access to entire team.
- If people are manually uploading files and sometimes mistakenly upload them into the Salesforce Files Component, copy them external storage so that team members not in Salesforce also have access.
- Transfer salesforce files to google drive for easier editing using the native google editors. This can also be extended to moving files to SharePoint, OneDrive for easier editing using Microsoft tools such as Word, Excel, Powerpoint etc...