Platform Events
All Event Types

Salesforce File Copied

Overview

This event is published when a Salesforce file is copied to external storage by Copy Salesforce Files flow action. This event works for all CloudFiles supported storages. The event type salesforce-file-copied can be used to filter this event. The corresponding Get Event Details flow action returns the Copied Salesforce File Details sub-type with useful information including source file id, destination file id, record id etc... for further use.

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.

  1. Parent Id - Id of the Salesforce record where the Salesforce file was uploaded. Along with the Object Type returned by the CloudFiles Event Object , this can point to a specific record in your org.
  2. ContentVersionId - Id of associated ContentDocumentLink -> ContentDocument -> ContentVersion. in your Salesforce that got copied. This basically refers to the Salesforce file that got copied. Note that Salesforce has a complex file storage mechanism. Make sure you understand the Content Document architecture of Salesforce to use this field.
  3. 

    Document image
    

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