Intelligent Document Processing: Invoices
Document AI Extraction With GL Classification And Human Confirmation
Built an end-to-end invoice intake pipeline on Salesforce that uploads PDFs, extracts fields via Data 360 Document AI, normalizes and GL-classifies line items with an Agentforce prompt template, and presents editable results in a custom LWC for AP review.
Sequence Diagram
Challenge
Accounts payable teams retyped invoice headers, vendor details, and line items from PDFs into Salesforce, a slow, error-prone process with no consistent GL coding and little auditability when extraction or classification failed mid-flow.
Key Outcomes
- Reduced manual invoice data entry for AP reviewers
- Standardized line-item GL classification against a shared expense chart
- Added human-in-the-loop confirmation before accepting extracted invoice data
- Surfaced extraction and normalization failures with explicit Flow error screens
View Approach Details
- Designed a Screen Flow on an Agentforce Studio flexipage for PDF upload, extraction, normalization, parse, and confirmation with dedicated error screens on failure.
- Implemented Apex invocable callouts to the Data 360 Document AI extract-data API using Named Credentials and an Invoice_Processing IDP configuration.
- Used an Agentforce prompt template to unwrap typed Document AI JSON into flat invoice schema and classify each line item to a standard GL expense chart.
- Built Apex normalizer and parser classes so Flow receives flow-friendly fields and a human-readable line-item display, with HTML-entity and markdown fence handling for prompt responses.
- Delivered an invoiceConfirmation LWC for in-flow review and edit of headers, amounts, payment details, and GL codes before returning confirmed JSON to the Flow.