On various actions related to files, CloudFiles publishes a Salesforce platform event named "CloudFiles Event", API name `cldfs__CloudFiles_Event__e`. This Event has got 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
CloudFiles Platform Event can be used to setup flows which trigger on platform events. To create a flow, select the trigger as "Platform Event" -
Next, select "CloudFiles Event" from the list of events as shown below -
Next, we will add a decision element in our flow to only run this flow for the event type we're interested in. For example - "file-uploaded"
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.