Flow Actions
Doc AI Flow Actions
Document Mapper
introduction the cloudfiles document mapper flow action allows you to execute a document mapper configuration directly from a salesforce flow this action processes a document, extracts structured data using the configured mapping, and then creates or updates salesforce records automatically this is especially useful when you want to convert documents such as invoices, forms, or contracts into salesforce records as part of an automated process, without requiring any user interaction what this action does the document mapper action runs an already created document mapper configuration against a provided file when the action is executed, cloudfiles processes the document using the configuration specified by the config id based on that configuration, salesforce records are created or updated automatically if a record id is not provided, the action creates new salesforce records exactly as defined in the document mapper configuration this includes creating a primary record and any related or child records, such as line items if a record id is provided, the action updates the specified salesforce record and creates any related records defined in the configuration this makes it possible to enrich existing records with data extracted from documents while still supporting complex parent–child record creation the action runs asynchronously and publishes events once processing is complete input parameters config id this parameter specifies the document mapper configuration that should be used when processing the document the configuration controls which salesforce objects are created or updated, which fields are populated, and how parent–child relationships are handled it also defines the prompts used by document ai to extract data from the document you can obtain the config id from the cloudfiles app > document ai > document mapper tab this value is required for the action to run resource the resource parameter represents the file that should be processed by document mapper this input must be provided as an apex defined variable that represents a cloudfiles resource the document referenced by this resource is the file from which data will be extracted and mapped to salesforce records record id (optional) the record id parameter allows you to specify an existing salesforce record to update when this value is provided, the document mapper run action updates the specified record using the extracted data any related or child records defined in the configuration are also created as part of the same execution if this parameter is not provided, the action creates new salesforce records based on the configuration output parameters the apex action does not return anything as an output in the flow it is used but for every file processed a docid\ rxirigallb7pu3ym3sfj5 event is published this event includes information about the processed document and the records involved in the execution and can be used to trigger platform event flows to perform any post processing actions if the action fails due to some reason, an error event event will be triggered and this event can be used in a decision element to diagnose and handle the error