Case Study: OCR Data Processing in Salesforce with Serverless AWS

Streamlining Invoice, Receipt, and Timesheet Processing with AWS Lambda, S3, and Salesforce Apex Batch Jobs.

  • S3
  • SSM
  • Apex
  • SOQL
  • Lambda
  • CloudFormation

Project Background

The client using Salesforce as its CRM, faced challenges with manual processing and review of invoice, timesheet, and receipt data sent in by employees. The process was time-consuming, and certain characteristics of an App the client used to process expenses in their Salesforce instance were insufficient to adequately store the PDF and image files being received.

To overcome these challenges, a solution was developed to offload the processing to AWS, utilising Amazon S3, AWS Lambda, and Salesforce Apex and SOQL.

Research & Development

We conducted a thorough analysis of the existing system and its pain points, and identified Amazon S3 and AWS Lambda as the most suitable services to address the client's requirements.

These services would facilitate the creation of a middleware solution that would enable the client to automate and streamline the process of receiving, uploading, processing, and transferring data between Salesforce and AWS, effectively bypassing the aforementioned limitations by taking advantage of the chosen AWS cloud services.


The proposed solution consisted of the following components:

  • Amazon S3: Employees would upload their invoice, timesheet, and receipt files to a designated S3 bucket prefix. Amazon S3 was chosen for its low cost, high availability, and security features. This eliminated the storage-specific limitations faced by the client with their Salesforce App.

  • AWS Lambda: A serverless AWS Lambda function would be triggered via S3 event notifications whenever a new file was uploaded by an employee. This function would process the files, extracting the relevant data from the data uploaded by the employee using Optical Character Recognition (OCR). This not only automated the data extraction process, but would also save the client a tremendous amount of time and effort when compared to manually processing uploads as was the case before.

  • Custom Salesforce Integration: The extracted data would be sent to Salesforce through a custom integration. A Batch Job written in Apex and deployed in Salesforce would periodically call out to the AWS Lambda function, parse the returned data, and ensure that it was stored in the appropriate Salesforce objects as specified by the client. This approach would allow the client to maintain control over the data flow without reinforcing its dependency on the Salesforce App.


The solution was deployed in the following steps:

  • We set up the Amazon S3 bucket with the necessary security and access permissions for employees to upload their files.

  • We then proceeded to develop the AWS Lambda function for processing the uploaded files, leveraging OCR technology to extract relevant data from the uploaded files, and prepare it for outbound transfer to Salesforce.

  • We created a custom Salesforce integration whereby a Salesforce Batch Job written in Apex can call the AWS Lambda function and retrieve the extracted data for subsequent import to Salesforce, mapping the data fields to the appropriate Salesforce objects.

  • Finally, we thoroughly tested the end-to-end integration, ensuring accurate data processing and transfer between AWS and Salesforce.


By implementing the proposed solution using Salesforce Apex, Amazon S3 and AWS Lambda, the client successfully offloaded the processing of invoice, timesheet, and receipt data to AWS, bypassing certain limitations of their Salesforce App that previously forced the client to manually process uploaded data.

Our solution streamlined their workflow dramatically, saving time and effort on manual data review and entry, and boosted productivity for both their employees and HR staff.

The solution also ensured seamless data exchange between Salesforce and AWS through a custom integration, making the process considerably more efficient and accurate, without reinforcing the client's existing licensed software dependencies.

Found this useful? Spread the word 🙏

Share this Case Study on LinkedIn

Book a free consultation; expect a reply within 1 business day 🎯

Looks good!
Please enter your first name.
Looks good!
Please enter your last name.
Looks good!
Please provide a valid email address.
Looks good!
Please select a category.
Looks good!
Please enter your messsage.

You must agree to the Privacy Policy before submitting this form.

* Fields marked with an asterisk (*) are required.