Case Study · Legal Technology

Revolutionizing Legal Document Processing
Through Salesforce & AWS Automation

📧 Email Automation 📄 Document Extraction 🤖 AI Summarisation ☁️ AWS Textract & Lambda ⚖️ Personal Injury Law

Innovative solutions that simplify document intake and boost efficiency for personal injury law firms

How We Helped a Personal Injury Law Firm Automate Email Attachment Summaries Inside Salesforce Using AWS Textract, Lambda, and AI

Twopir Consulting designed and implemented a Salesforce-to-AWS document intelligence workflow that captures inbound email attachments, extracts text from PDFs and Word documents, generates AI-powered summaries, and writes the results back to Salesforce Case Notes and EmailMessage records.
Faster Review Cycles
Consistent Case Notes
Scalable Document Intake
0
Manual Attachment Reviews

The Client:

A personal injury law firm using Salesforce to manage case activity, inbound communications, and matter records.

The firm regularly receives document-heavy email attachments such as medical records, insurance correspondence, demand letters, and supporting legal paperwork that must be reviewed quickly by attorneys and case staff.

To improve response speed without increasing manual administrative effort, the firm partnered with Twopir Consulting to automate document extraction and case note creation within its existing Salesforce workflow.

The Problem:

The firm's legal team relied on manual review of attached PDFs and Word files before key information could be entered into Salesforce. That process slowed case progression, created inconsistent summaries, and made it harder for attorneys to access important details quickly.

01. Manual Document Review Slowed Case Work

  • Paralegals and support staff had to open each attachment, read the contents, and manually write summaries into Salesforce Case Notes.
  • As document volume increased across active matters, the process became difficult to scale.

02. Important Information Stayed Buried in Attachments

  • Critical updates often remained locked inside medical reports, insurance files, and other inbound documents until someone reviewed them manually.
  • This reduced visibility for attorneys who needed fast access to case developments inside Salesforce.

03. Disconnected Processing Reduced Consistency

  • Without a standard extraction and summarisation workflow, note quality varied by user and by document type.
  • The team needed a repeatable way to process PDFs, DOCX, and DOC files while keeping all outputs tied to the right Salesforce records.
⚡ Document Processing Workflow
📧
Inbound Email
Salesforce
🔍
Attachment Detection
Apex Logic
☁️
AWS S3
File Staging
Lambda
Processing
📑
Textract
OCR / Extract
🤖
AI Summary
Generation
📋
Case Notes
Salesforce

Tool and Use Case:

☁️
Salesforce Service Cloud + Apex
System of record for case activity, inbound emails, orchestration logic, and record updates.
AWS Lambda + API Gateway + S3
Serverless processing layer for handling inbound attachments outside Salesforce governor limits.
📑
Amazon Textract
OCR and text extraction for PDF documents, including asynchronous processing for large files.
🤖
AI Summarisation
Extracted content sent for AI summarisation, with final output written back to Salesforce.

Salesforce Service Cloud + Apex

  • System of Record: Salesforce served as the central platform for case activity, inbound emails, orchestration logic, and record updates.
  • Custom Apex Logic: Identified attachments, routed files by type, stored processing status, and updated related EmailMessage and Case Note records once summaries were available.
  • Orchestration: Apex scheduled jobs monitored extraction completion and triggered downstream summarisation steps, ensuring outputs reached the right Salesforce records.
  • Governor Limit Management: By offloading heavy processing to AWS, the integration kept Salesforce well within platform limits while maintaining a seamless user experience.

AWS Lambda + API Gateway + Amazon S3

  • Serverless Processing Layer: AWS provided the backend infrastructure for handling inbound attachments outside Salesforce governor limits.
  • File Staging in S3: Attachment files were securely staged in Amazon S3 before being routed through Lambda, ensuring reliable processing at scale.
  • API-Driven Integration: Files were exposed to Salesforce through API Gateway callouts, maintaining a clean integration pattern with clear boundaries between systems.
  • Dual Processing Paths: Lambda handled both asynchronous Textract jobs for PDFs and faster extraction paths for DOCX and DOC files, optimising speed for each document type.

Amazon Textract

  • OCR & Text Extraction: Amazon Textract handled precise text extraction for PDF documents, especially where asynchronous processing was required for larger files.
  • Job Tracking in Salesforce: Salesforce stored the returned Textract job ID in a custom object, with scheduled Apex monitoring completion before continuing the workflow.
  • High-Accuracy Document Parsing: Textract's machine learning–based extraction ensured reliable results across medical records, insurance correspondence, and legal filings.
  • Asynchronous Model: The async pattern prevented timeouts and allowed the system to handle high-volume document intake without bottlenecks.

AI Summarisation

  • Automated Summary Generation: Once document text was available from Textract or Lambda extraction, the content was sent for AI summarisation to produce concise, attorney-ready case notes.
  • Written Back to Salesforce: Final summaries were written directly into Salesforce Case Notes and EmailMessage records, making document insights immediately visible to case teams.
  • No Attachment Required: Attorneys could access key document highlights without opening every attachment, reducing time spent on administrative review.
  • Consistent Output Quality: Standardised summarisation logic ensured uniform note quality across all document types and all users, replacing the previous inconsistency of manual note-writing.

Our Approach:

Twopir Consulting followed a structured implementation approach focused on fitting automation into the client's existing legal operations rather than forcing users into a new process.

1

Step 1: Workflow Assessment

  • Reviewed the client's Salesforce email handling process, attachment types, note-writing workflow, and downstream case management needs.
  • Identified where PDFs required asynchronous processing and where DOCX and DOC files could be handled through a faster extraction path.
  • Mapped integration points between Salesforce, AWS, and the firm's existing legal operations.
2

Step 2: Integration and Automation Build

  • Built the Salesforce-to-AWS integration layer for file upload, text extraction, job tracking, and summary generation.
  • Implemented custom objects and scheduled Apex to manage asynchronous Textract jobs and ensure extracted content returned to the correct case-related records.
  • Configured API Gateway and Lambda functions to handle both PDF and Word document processing paths reliably.
3

Step 3: Output Delivery Inside Salesforce

  • Configured the process so summaries were stored directly in Salesforce Case Notes and EmailMessage records.
  • This kept attorneys and staff inside the CRM while improving access to concise, review-ready document context.
  • Monitored KPIs and refined automated sequences based on user feedback to ensure measurable efficiency gains.

The Solution:

Automated Attachment Detection

When an inbound email reached Salesforce, the system checked whether an attachment was present and identified the file type before routing the document for processing.

Dual Processing Paths for PDF and Word Files

PDF files were sent to AWS for Textract-based extraction using an asynchronous job model. DOCX and DOC files were routed through Lambda-based extraction for a faster response path where appropriate.

Custom Job Tracking in Salesforce

A custom Salesforce object stored the processing job ID, status, and record relationships needed to track extraction progress and connect outputs back to the right case context.

Scheduled Retrieval and Summary Generation

A scheduled Apex job checked for completed extraction jobs, retrieved the text, and triggered AI summarisation once the source content was ready.

Case Notes Updated Automatically

Final summaries were written into Salesforce so attorneys and support staff could review document highlights without leaving the case workflow.

End-to-End Audit Trail

Every step — from attachment detection through extraction to summary delivery — was logged within Salesforce, giving the firm full traceability across all processed documents.

Impact and Outcomes:

Faster Review Cycles

The client reduced the time spent manually reading attachments and drafting internal notes, helping legal teams move from inbox review to case action more quickly.

More Consistent Case Notes

Standardised extraction and summarisation improved the consistency of document summaries across matters and users.

👁️

Better Visibility for Attorneys

Key information from inbound documents became easier to access within Salesforce, improving day-to-day visibility for attorneys and case managers.

📈

Scalable Document Handling

The solution created a repeatable workflow for high-volume document intake without requiring a proportional increase in administrative effort.

Relatable? We should definitely talk.


What we'll cover:

From CRM and integrations to custom apps and complex system architecture — we help you scale without chaos.
  • Identify revenue leaks across CRM, integrations, and GTM
  • Design and optimize complex systems (CRM to Custom Apps)
  • Apply practical AI to improve operations and pipeline conversion
  • Eliminate silos and build a unified revenue system
  • Assess GTM performance and key bottlenecks
  • Align teams with clear processes and ownership
  • Define a scalable RevOps model
  • Improve forecasting and reporting
  • Review your HubSpot/Salesforce setup for scale