Flow Actions
Doc AI Flow Actions

Split Document using AI

introduction the cloudfiles split document using ai flow action enables automated splitting of merged pdf files stored in salesforce or external cloud storage into individual documents by leveraging ai, the action intelligently identifies and separates multiple documents within a merged pdf this is particularly useful for processing files like scanned bundles of invoices or multi document contracts what this action does the cloudfiles split document using ai action asynchronously processes a merged pdf file—whether stored in salesforce or external storage—and intelligently splits it into multiple individual documents based on its content once complete, it performs the following publishes a document split docid jiiuobrwu1xxigbb3czc event this platform event includes metadata for each split file and can be used to trigger follow up flows uploads a searchable version of the original file if the submitted document was a scanned, non searchable file (e g , image based pdf), a searchable, ocr enhanced version of the original merged file is also created and stored in the specified destination auto names each split file every generated split file is automatically named using ai , based on the content within that file (e g , document type, person name, or reference id) these enhancements allow for better indexing, file retrieval, and immediate usability of both the original and split documents example use case automating the processing of uploaded invoice bundles a merged pdf containing multiple invoices—often scanned and non searchable—is submitted to the flow the split document using ai action processes the file, performs ocr to generate a searchable version of the original document, and splits it into individual invoice files each split file is auto named using ai based on invoice specific details (e g , invoice number, vendor name) saved alongside the searchable original file in a specified salesforce record or external storage folder this setup ensures improved document searchability, easier identification, and seamless automation of invoice handling or record updates in salesforce input parameters in your flow builder, search for the element named " cloudfiles split document using ai " you can find this action in the cloudfiles category when you click on the "action" element in the "add element" box select the action to insert it into the flow, and then configure the input parameters to split a salesforce file in order to specify a salesforce file to be processed, input paramters as library salesforce fileid the contentdocumentid of the salesforce file to be split you can get the contentdocumentid of the salesforce file from other standard salesforce elements like "get records" or standard screen flow "upload files" component or from details of cloudfiles events like salesforce file attached docid\ cnswhxyiaabekamvbfxon you can only split a salesforce file in contentdocument https //developer salesforce com/docs/atlas en us object reference meta/object reference/sforce api objects contentdocument htm format you cannot split an attachment i e classic salesforce file format it is mandatory to input both library and fileid to specify a salesforce file to split an external storage file if you are using cloudfiles document managemnt pacakage as well, then you can process and split the file in connected external storage as well in order to specify an external storage file to be processed, input paramters as library the library parameter is the external storage type you are using possible values are sharepoint , google (for google drive), azure , onedrive , dropbox , box , cloudfiles (for aws s3) drive id the id of the drive where the document resides this is important for google drive & sharepoint libraries only the drive id is a unique identifier for a storage location in both sharepoint and google drive in sharepoint, it represents a document library within a site, while in google drive, it identifies a user's drive or shared drive file id the unique identifier (resource id) of the file that is to be processed based on the use case, you can get these parameters from details of other cloudfiles events like file uploaded docid\ p yy1ryebu5ecnctf0jhd or file received docid\ napychk2t4mc8kkvguxig etc context an optional identifier to track the source of the event or any other intended/necessary details this shall be available in corresponding output i e in the corresponding document split docid jiiuobrwu1xxigbb3czc event details the context parameter is particularly helpful if this action is used in multiple flows for example, if you’re processing documents attached to contact records, you can set the contact’s record id as the context when events are published, this context value will help you track the origin of each event by showing the associated contact record instructions (optional) you can guide the ai by adding specific instructions for how to interpret and split the document providing contextual cues can improve the accuracy of the split, especially for varied or non standard formats for example “this is a bundle of scanned invoices each invoice starts with a bold header containing 'invoice number' and ends with a subtotal split at each occurrence of this pattern ” destination the destination parameter determines where the generated files will be stored after cloudfiles completes the splitting process steps to configure destination create an apex defined variable of apex class cldfs resource assign the necessary metadata (e g , library, drive id, id) based on the chosen storage option to save in salesforce default behavior (salesforce files) if no destination parameter is specified, the files shall be stored in the salesforce file library link to a specific record assign the following fields library set to salesforce id set to the record id of the salesforce record to which the files will be linked to store in external storage when using cloudfiles with the cloudfiles | document management & sharing platform assign the following fields to define the external storage location library specify the library name drive id specify the id of the connected drive id specify the id of the folder or location within the drive pass the configured variable as the destination parameter in the cloudfiles split document using ai action this setup provides flexibility to store files in salesforce or external storage, aligning with your business needs output parameters the apex action does not return anything as an output in the flow it is used but for every file processed for split, a document split docid jiiuobrwu1xxigbb3czc event is published this event signals the completion of document split and can be used to trigger platform event flows to perform post split actions