Error Event
The event is triggered when a CloudFiles flow action fails, giving users real-time insights into the failed action. This event provides specific details about which file or resource caused the failure, empowering users to set up custom error handling workflows. The Error Event is currently configured for the Copy Salesforce File action, the Document Processed action, and includes support for the Process Document Using AI action.
With this feature, users can automate how they handle errors. For example, when a document processing action fails, you’ll receive details about the file that didn’t process correctly. From there, you can create flows to automatically track failed files or move them to a designated folder for manual intervention.
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.
Use error-event as the type filter when setting up a decision element in Flow Builder. This ensures that any error caused by CloudFiles actions, such as a failed document process, is captured and ready for handling.
The corresponding Get Event Details flow action returns the Error Event sub-type with useful information including error event type, error reason etc for further use. Refer to the image below for a list of outputs and descriptions of the parameters returned in this sub-type.
- DocumentProcessedError - This contains corresponding details of the document for which Document Processed flow action failed. It includes file and context of the document.
- SalesforceFileCopiedError - This contains corresponding details of the document for which Copy Salesforce File flow action failed. It includes following details.
- Destination - The resource of the destination to which file were supposed to be copied.
- ContentVersionId - Content version Id of the file that was supposed to be copied.
- Record Id - Record Id of the record to which file belongs.
- ErrorEventType - The specific nature of the error. It is the corresponding platform event of the flow action which is failed. (e.g., salesforce-file-copied, document-processed).
- ErrorReason - An error prompt which is a description of an error (e.g., "something went wrong").
Here are some practical use cases for leveraging the Error Event to handle errors in CloudFiles workflows:
- Track Failed AI Document Processing - Automatically detect when a document fails to process using AI and move it to a specific folder for manual review and reprocessing.
- Automate Failed File Handling - Set up flows to track files that failed to copy, triggering automatic retries or alerts to team members for immediate action.
- Custom Error Reporting - Create a flow that tracks all failed actions and generates a report on error types, resources, and associated records to streamline troubleshooting