LST Consultancy

Case Study · Salesforce Sales Order Automation

Email-to-Sales Order Automation on Salesforce: 90%+ OCR Accuracy at 500+ Emails a Day

How LST Consultancy turned a busy inbox of customer purchase orders into an automated, approval-driven sales order process inside Salesforce.

OCR accuracy
90%+
emails a day
500+
lost attachments
Zero

At a Glance

Client
A sales-driven organization receiving a high volume of customer purchase orders and invoices by email
Systems
Salesforce, Nanonets OCR and Microsoft Graph API
Service
Salesforce-native sales order automation using Email Services, Apex, OCR and Lightning Web Components
Challenge
Manual order entry from emails in mixed formats, unclear salesperson attribution and no central email tracking
Solution
Automated email ingestion, OCR data extraction, a split-screen review screen and one-click Sales Order creation
Results
90%+ OCR accuracy on standard invoice formats, 500+ emails processed per day, no lost attachments and faster email-to-order turnaround

Quick summary

LST Consultancy built a Salesforce-native sales order automation solution that captures inbound order emails, extracts order data from attachments with OCR, and turns approved data into Sales Orders with line items. The solution reaches over 90% OCR accuracy on standard invoice formats, handles more than 500 emails a day, and keeps every attachment safely stored and linked in Salesforce.

About the Client

The client is a sales-driven organization that receives a large volume of customer purchase orders and invoices by email. Sales representatives forward these emails to a central mailbox for processing, and the company uses Salesforce to manage customers, products and revenue operations.

The Challenge

Turning customer purchase orders into sales orders was slow and manual.

  • Orders in Every Format

    Sales orders arrived across many emails, with attachments in different formats.

  • Manual Data Entry

    Order details were typed into Salesforce by hand, causing delays and errors.

  • Unclear Attribution

    It was hard to tell which salesperson had forwarded each order.

  • No Central Tracking

    Inbound emails and attachments weren’t tracked in one place.

  • Unreadable or Missing Attachments

    Problem documents created bottlenecks in order processing.

  • Mapping Risks

    Products could be mapped incorrectly, and some customer accounts didn’t exist yet in Salesforce.

The Solution

LST Consultancy built a Salesforce-native email-to-sales order automation framework using Salesforce Email Services, Nanonets OCR, Apex and Lightning Web Components.

Order inbox

Forwarded by sales reps

  • PO-88412.pdfFrom: rep aliasReceived
  • Order.xlsxVia GraphConverted
  • No attachmentBody to PDFConverted
  • Scan_0312.jpgLow qualityManual

Email Services + Apex + Nanonets OCR

  • Header parsing
  • Queueable Apex
  • JSON extract
  • Retries

Salesforce

Review, approve, create

  • Email Storage recordFiles linked, nothing lost
  • Split-screen reviewDocument beside the data
  • Sales Order + linesCreated on approval
  • SalespersonAttributed from headers
  • Email Ingestion and Storage

    • Salesforce Email Services provides a single inbound email address.
    • An Apex Inbound Email Handler captures each email’s metadata, body, headers and attachments.
    • A custom Email Storage object tracks every inbound email.
    • Attachments are stored securely as Salesforce Files, linked to their email record.
  • Salesperson Identification

    • The forwarding salesperson is identified from the email headers.
    • Admins can map forwarding aliases to Salesforce users.
    • Every Sales Order is attributed to the right person.
  • OCR Processing and Data Extraction

    • Attachments are sent to Nanonets OCR in the background using Queueable Apex.
    • Order header and product line data is extracted in JSON format.
    • The extracted data is saved against the email record for review.
  • Review and Approval Screen

    • A split-screen Lightning Web Component shows the original document on the left and the extracted fields and line items on the right.
    • Reviewers can Approve (creating the Sales Order), Reject, Preview or Create Account.
  • Sales Order Creation

    • Approved records automatically create Sales Orders and Sales Order Line Items.
    • The system checks that the customer account exists and that products map correctly.
    • If a customer is missing, reviewers are guided through creating the account.
  • Exception Handling

    • Emails without attachments are converted into PDFs from the email body.
    • A manual data entry flow handles unreadable documents.
    • Microsoft Graph API converts Word and Excel files into PDFs for processing.

How We Delivered It

We delivered the solution in five phases.

  1. Requirement Analysis

    We captured the inbound email scenarios, OCR scope and approval workflows.

  2. Solution Design

    We designed the email ingestion architecture, the data model and the OCR integration.

  3. Development

    We built the Apex Inbound Email Handler, the Email Storage object, the OCR integration with Queueable Apex, the review and approval screen, and the Microsoft Graph integration.

  4. Testing

    We validated OCR accuracy, salesperson mapping, error scenarios and bulk email processing.

  5. Deployment

    We rolled out the solution with user training and monitoring.

Technical highlights

  • Salesforce Email Services
  • Apex Inbound Email Handler
  • Queueable Apex
  • Nanonets OCR REST API
  • Microsoft Graph API
  • Lightning Web Components
  • Custom metadata for API keys

Obstacles We Overcame

Automating orders from a shared inbox raised five issues. Here’s how we handled each one.

  • Identifying the correct salesperson

    Challenge
    Forwarded emails didn’t clearly show which salesperson sent each order.
    How we solved it
    Header-based logic with admin mapping of aliases to users.
  • OCR failures

    Challenge
    OCR calls could fail and leave orders unprocessed.
    How we solved it
    A retry mechanism, with manual entry as a fallback.
  • Unreadable documents

    Challenge
    Some attachments couldn’t be read at all.
    How we solved it
    Manual PDF generation and data entry.
  • Product mismatches

    Challenge
    Extracted products didn’t always match Salesforce products.
    How we solved it
    Product validation and a mapping interface.
  • Performance under load

    Challenge
    Hundreds of emails a day could slow processing.
    How we solved it
    Asynchronous processing and batching.

The Results

The automation made order intake accurate, traceable and fast.

  • By the Numbers

    90%+
    OCR accuracy on standard invoice formats
    500+
    emails a day handled by a scalable solution
  • What Changed

    1. No lost attachmentsCentralized email storage keeps every file linked to its email.
    2. Less manual entrySignificantly less manual order entry.
    3. Faster turnaroundFrom email receipt to Sales Order creation.
    4. Clear accountabilityEvery order is attributed to the right salesperson.

Key Takeaways

  1. Plan for exceptions from the start

    Email-driven automation only works with strong handling for missing, unreadable and unusual documents.

  2. Keep a human in the loop for financial documents

    A quick review step catches the rare OCR misread before it becomes an order.

  3. Email headers hold the answers

    Header analysis is essential for knowing who forwarded each order.

  4. Process asynchronously

    Background processing keeps the system fast at hundreds of emails a day.

Frequently Asked Questions

Answers to common questions about sales order automation and OCR in Salesforce.

Typing purchase orders into Salesforce?

Talk to our team about turning your order emails into approval-ready Sales Orders.

Ready to Automate Sales Orders from Your Inbox?

LST Consultancy can turn your order emails into automated, approval-ready sales orders, so your team spends less time typing and more time selling.

sales@lstconsultancy.com+91 70582 77886

Salesforce, Apex and Lightning Web Components are trademarks of Salesforce, Inc. Nanonets is a trademark of its owner. Microsoft, Microsoft Graph, Word and Excel are trademarks of the Microsoft group of companies.