Platform Events
All Event Types

Salesforce File Copied

Overview

This event is published for every Salesforce File that is copied to external storage by using the Copy Salesforce Files flow action. This event works for all CloudFiles supported storages.

This event only triggers when the Copy Salesforce Files action was used to initiate the copy of the file to the external storage.

How to use this Event ?

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.

Document image


Event Type for Decision Filter

Please use salesforce-file-copied as the type filter when selecting this event in the decision element in flow builder.

Output Fields from Get Event Details

The Get Event Details provides the Copied Salesforce File Details sub-type to output the information for this event. It provides useful information including source file id, destination file id, record id etc... for further use.

Refer to the image below for a list of outputs and descriptions of the parameters returned in this sub-type.

Document image

  1. Resource - A lookup Field of type Resource ( cldfs_Resource )which shall contain the External Storage Resource's metadata details.
    1. driveId - The external storage drive ID
    2. id- The unique resource ID
    3. library- The External Storage Library (Ex sharepoint)
    4. name- The Name of the File/Folder
    5. path- The Storage Location Path of the File/Folder (Null if the storage is Google Drive)
    6. type- file or folder based on the Resource Type.
  2. ContentVersionId - ContentVersionId of the Salesforce file (ContentDocument) that got copied.
  3. ParentId - The Text string input in the corresponding Copy Salesforce Files action. (e.g., the Record ID or any other identifier provided during the action).

Use Cases

In this section we present some use-cases for this platform event.

  1. Mark the Salesforce file as copied after it has been copied into SharePoint.
  2. Delete a file from Salesforce after it has been successfully copied into SharePoint.
  3. Update the initiating record fields to mark it for scheduled deletion of stored files