Resource Attached
The Resource Attached Event is triggered whenever a file or folder in external storage is attached to a Salesforce record via:
- Manual Connection:
- When a user manually attaches a resource through the CloudFiles LWC on a Salesforce record page.
- Create Attachment Action:
This event enables seamless automation for scenarios requiring further actions based on resource attachment, such as notifications, logging, or updates.
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.
In Flow Builder, use resource-attached as the event type filter in decision element.
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.
- Resource - A lookup Field of type Resource ( cldfs_Resource )which shall contain the connected/attached Resource's metadata details.
- driveId - The external storage drive ID
- id- The unique resource ID
- library- The External Storage Library (Ex sharepoint)
- name- The Name of the File/Folder
- path- The Storage Location Path of the File/Folder (Null if the storage is Google Drive)
- type- file or folder based on the Resource Type.
- Object Type - The Salesforce object's API name (e.g., Account, Opportunity) where the resource is attached.
- Record Id - The Salesforce record ID associated with the attachment.
In this section we present some use-cases for this platform event.
- Create a list of all manual attachments done by team members on various records to get a report of content consumption against record types.
- Read the files of the attached resource and determine if certain file types have been uploaded to advance opportunity status.
- Copy the attached record files from Salesforce storage to external storage for migration or archival, and optionally delete them from salesforce.