Loading
Automate Your Business Processes
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Process and Review Attached Documents Example

          Process and Review Attached Documents Example

          This example walks through a record-triggered flow that runs when a user attaches a document to a record. The flow extracts data, routes to an approval action and flow orchestration, then to a screen flow where the user reviews and corrects extracted values before the flow updates the record.

          Required Editions

          Available in: Lightning Experience
          View supported editions.
          This feature requires the MuleSoft for Flow: IDP add-on. Professional Edition requires the API access add-on. To purchase, contact your Salesforce account executive.
          Document processing features require Einstein generative AI turned on in Setup, and Data 360 provisioned and enabled for your org.
          MuleSoft for Flow: IDP features used with Agentforce require the Foundations or Agentforce 1 edition. To purchase these editions, contact your Salesforce account executive.
          User Permissions Needed
          To create, read, edit, and delete document processing configurations: Manage Document Processing Configurations
          To open, edit, or create an orchestration in Flow Builder: Manage Flow
          To create screen flows for human review interfaces: Manage Flow

          This example uses a record-triggered flow, an approval action, and a flow orchestration. Extraction runs in the parent flow; the review screen runs in a separate screen flow invoked by the orchestration. Because extraction and review are on different paths, you must create variables at each stage to pass data (for example, content document ID and extraction output into the orchestration and screen flow, and the reviewed data back to the parent flow). The user sees the review screen in the Approvals experience when they open the approval request.

          For a simpler pattern where extraction and review are on the same flow path and variables auto-populate, see Review Contract Data and Update Records Example.

          Before you build this example:

          1. Create a record-triggered flow that runs when a file is attached to your chosen record type (or when a content document is created or updated in the context you need).

            Configure the start element to fire on the object and conditions that match your scenario. Ensure you can access the Content Document ID (or equivalent) from the trigger so you can pass it to the Extract Data from Document action.

          2. Add the Extract Data from Document action and set the document and document processing configuration inputs from the trigger or from variables you create.

            Store the action output in a variable so you can pass it to the orchestration and screen flow. You will use this variable when you set up the approval action and orchestration inputs.

          3. Add a decision element to route to human review when your conditions are met (for example, when the confidence score for any extracted value is below your threshold).

            On the outcome that requires review, connect to an approval action. On the other outcome, you can update the record directly with the extracted data if no review is needed.

          4. Add an approval action that calls a flow orchestration.

            Configure the approval action to invoke your flow orchestration. Map the values the orchestration needs from the parent flow (for example, content document ID, document processing configuration ID, and the extraction action output) into the orchestration input variables you define in the next step.

          5. In the flow orchestration, create input variables to receive the values passed from the parent flow (for example, content document ID and extraction output).

            Define variables that match the data you need to pass into the screen flow. Create output variables to hold the result returned from the screen flow (for example, modified or approved data) so you can map them back to the parent flow.

          6. In the orchestration, add a subflow element that calls the screen flow. Pass the orchestration input variables into the screen flow inputs as required by your screen flow.

            Map the content document ID, document processing configuration ID, and extracted data (or the values the screen flow expects) from the orchestration variables to the screen flow input parameters. If passing the extraction action output causes a data type incompatibility in the Review Extracted Data component, pass individual values instead (for example, using display text or other supported types) as a workaround.

          7. In the screen flow, add the File Preview component and the Review Extracted Data component. Configure them to use the values passed from the orchestration (content document ID, document processing configuration ID, and extracted data or individual values).

            Reviewers see the attached document and the extracted values, can correct low-confidence or incorrect values, and submit. The screen flow should output the reviewed or modified data so you can assign it to an output variable and pass it back to the orchestration.

          8. In the orchestration, assign the screen flow output to the orchestration output variables, then map those outputs back to the parent flow in the approval action configuration.

            The parent flow receives the orchestration output (for example, the reviewed data). Use it in subsequent elements to update the record or related records.

          9. In the parent flow, add elements to update the record (or related records) with the reviewed data returned from the orchestration.

            Use the output from the approval action (orchestration output) to set field values on the triggered record or related records. Save and activate the flow, then test by attaching a document to a record and completing the approval to run the review screen.

           
          Loading
          Salesforce Help | Article