Platform Events
CloudFiles Platform Event
On various actions related to files, CloudFiles publishes a Salesforce platform event named CloudFiles Event. This Event has following fields -
- Type - Type of the event. For example - file-uploaded, folder-created etc.
- Data - Data related to the event. This fields is used internally by the Get Event Details flow action to return the event details
- Object Type - Salesforce record type where the event originated. Example - Account, Case etc. For event originated outside a record context, this field is null
- Request Id - Exists when the event is published as a result of an asynchronous action
CloudFiles Platform Event can be used to setup flows which trigger on platform events. Please follow the steps below to setup an event based flow -
- To create a flow, select the trigger as "Platform Event"
Salesforce Platform Event based flow
- Select "CloudFiles Event" from the list of events as shown below
- Add a decision element in our flow to only run this flow for the event type we're interested in. For example - file-uploaded. Optionally, you can specify a Object Type filter to limit the flow execution for specific Salesforce record type
- Next, we will use the flow action Get Event Details to get the data related to the event. This data can be used in further flow elements. For example, on file upload, you may want to use the file name and save it on a specific property on a Salesforce record. To do this, insert the flow action named "Get Event Details" and configure it as shown below -
The value of "Event" fields is simply {!Record} as the flow Record variable is our platform event.
The output to this flow action can further be used in the flow. Output for each type is explained in the articles specific to each type of event.