Platform Events
All Event Types

Resource Attached

Overview

The Resource Attached Event is triggered whenever a file or folder in external storage is attached to a Salesforce record via:

  1. Manual Connection:
    • When a user manually attaches a resource through the CloudFiles LWC on a Salesforce record page.
  2. Create Attachment Action:

This event enables seamless automation for scenarios requiring further actions based on resource attachment, such as notifications, logging, or updates.

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

In Flow Builder, use resource-attached as the event type filter in decision element.

Output Fields From Get Event Details

The corresponding Get Event Details flow action returns the Resource Attached sub-type with useful information including attached Resource's Metadata details, Salesforce Object type and Salesforce RecordId 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 connected/attached 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. Object Type - The Salesforce object's API name (e.g., Account, Opportunity) where the resource is attached.
  3. Record Id - The Salesforce record ID associated with the attachment.

Use Cases

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

  1. Create a list of all manual attachments done by team members on various records to get a report of content consumption against record types.
  2. Read the files of the attached resource and determine if certain file types have been uploaded to advance opportunity status.
  3. Copy the attached record files from Salesforce storage to external storage for migration or archival, and optionally delete them from salesforce.