Industry
Enterprise Technology
Region
Enterprise — Global
Client Type
Enterprise Salesforce Client
Upload Challenge
Files exceeding 16 MB
Platform
Salesforce + Google Drive API
Delivery
Multi-phase implementation
~2 MB
Chunk size — precisely engineered to stay inside Apex callout limits on every upload, every time
0
Upload failures for large files after deploying the chunked resumable architecture — down from recurring failures
Effective upload capacity increase — from ~5 MB synchronous ceiling to async + chunked multi-pass handling
100%
Automated Google Drive folder creation — folders named and structured from Salesforce record data, no manual steps
1
Custom object (Lynx Content Map) solved the validation-rule conflict and now maps every Salesforce record to its Drive folder
LWC
Full migration from Visualforce to Lightning Web Components — removing the 16 MB upload wall and modernising the UI

Challenge vs. Solution

Six Governor-Limit Problems That Blocked Every Large Upload — and Six Fixes That Resolved Them

✕ Before — The Challenges 6 Problems
Synchronous Apex capped uploads at ~5 MB — the 6 MB heap limit meant any file slightly larger silently crashed the upload process.
Base64 conversion threw a hard string-length error at 12,000,000 characters — converting large files to Base64 in a single pass was impossible.
Visualforce upload ceiling blocked files over ~16 MB — the legacy upload page couldn't handle anything beyond that platform-imposed limit.
Google Drive's resumable upload protocol was unhandled — the original integration had no logic to start a session, receive the upload URL, or sequence chunks.
Writing the Google Folder ID back to Opportunity triggered validation rule failures — there was no safe place to store the Salesforce-to-Drive mapping.
Large file uploads were unreliable and unpredictable — users had no confidence that a file would successfully reach Google Drive, especially above 10 MB.
✓ After — What We Built 6 Fixes
We converted the entire upload pipeline to asynchronous Apex using Queueable jobs — breaking the synchronous heap ceiling and extending reliable capacity to ~12 MB and beyond.
We split files into ~2 MB chunks before Base64 encoding — each chunk converts cleanly within Apex string limits, then uploads sequentially as part of a resumable session.
We replaced the Visualforce upload page with a Lightning Web Component — eliminating the 16 MB ceiling and delivering a modern, responsive upload interface inside Salesforce.
We implemented the Google Drive Resumable Upload API end-to-end — initiating sessions, capturing the session URL, and uploading each chunk in the correct sequence until the file is complete.
We created a dedicated custom object — Lynx Content Map — to store Salesforce record IDs alongside their Google Folder IDs, bypassing validation rule conflicts entirely.
We automated Google Drive folder creation from Salesforce record names — users now upload directly from a Salesforce record into an auto-named, structured Drive folder with zero manual steps.

What We Did

Five Phases That Took the Client From Governor-Limit Failures to Zero Upload Errors

Discovery

Mapped Every Governor Limit Before Writing a Line of Code

We started by documenting the exact failure points — synchronous heap at 6 MB, Base64 string ceiling at 12,000,000 characters, Visualforce at ~16 MB, and the callout limits affecting chunked API calls. Understanding the full constraint map before implementation meant we could design an architecture that stayed inside every boundary.

Salesforce Governor Limit Analysis Google Drive API Review Architecture Blueprint LWC Migration Plan
LWC Migration

Replaced Visualforce with Lightning Web Components to Remove the Upload Ceiling

We rebuilt the upload interface as a Lightning Web Component — eliminating the Visualforce 16 MB upload restriction and giving users a clean, modern file-selection UI directly inside Salesforce records. The LWC handles file chunking at the browser layer before handing off to Apex.

Lightning Web Components Visualforce Deprecation JavaScript File API
Chunked Upload Architecture

Built the ~2 MB Chunk Pipeline with Async Apex and Resumable Session Handling

We implemented Queueable Apex to process each ~2 MB chunk asynchronously — staying inside both heap and callout limits. Each job initiates or continues a Google Drive Resumable Upload session, POSTing the chunk to the session URL and triggering the next Queueable job until the full file is assembled on Drive.

Queueable Apex Google Drive Resumable Upload API Apex HTTP Callouts Named Credentials Auth Provider
Folder Mapping

Created Lynx Content Map Object to Solve the Validation Rule Conflict

Storing the Google Folder ID directly on the Opportunity record triggered validation rules we couldn't modify. We created a custom object — Lynx Content Map — that stores the Salesforce record ID alongside its Google Folder ID, allowing the mapping to be reused across any object without touching existing validation logic.

Custom Object Design Salesforce–Drive Record Mapping Validation Rule Bypass
Automated Folder Creation

Wired Google Drive Folder Creation to Salesforce Record Names — Zero Manual Steps

We built the folder-creation logic so that when a user uploads from a Salesforce record, the system automatically creates a correctly named Google Drive folder (based on the record name), stores the folder ID in Lynx Content Map, and uploads the file directly into that folder. Salesforce users never leave their record to manage Drive.

Google Drive Folder API Apex HTTP Callouts Record-Name Mapping Custom LWC Button

The original upload kept failing on anything over 10 MB — every large file was a risk. After Twopir rebuilt the architecture, we stopped thinking about upload limits entirely. The chunked approach just works, and the automated Drive folder creation saves the team from a lot of manual organising.

— Twopir Project Lead  ·  Enterprise Salesforce Client  ·  2024

Key Outcomes

What Changed — In Numbers and in Practice

Zero

Upload failures eliminated for large files

The chunked resumable architecture removed the recurring upload crashes that previously affected every file above ~5–10 MB, giving users complete confidence in the upload process.

~2 MB

Precision chunk size stays inside every Apex governor limit

Each chunk is processed asynchronously, Base64-encoded without hitting string limits, and uploaded to Google Drive's resumable session URL — sequenced correctly every time.

LWC

Visualforce fully replaced with Lightning Web Components

The legacy Visualforce upload page — which imposed a hard ~16 MB ceiling — was replaced with a modern LWC interface that handles file chunking at the browser level before Apex ever sees the data.

1 object

Lynx Content Map cleanly handles all Salesforce-to-Drive mappings

A single custom object now stores Salesforce record IDs alongside their Google Folder IDs — reusable across any object, conflict-free, and extensible as the client adds more record types.

Auto

Google Drive folders created and named from Salesforce record data automatically

Users trigger an upload from inside a Salesforce record; the system creates the Drive folder, names it from the record, stores the mapping, and uploads the file — with no manual folder management required.

Async

Queueable Apex architecture is scalable and non-blocking

Because uploads run as chained Queueable jobs, the Salesforce UI never locks — users can continue working in the record while the file uploads in the background, chunk by chunk, until complete.

Running into Salesforce Governor Limits on File Uploads or Storage?

We'll audit your current upload architecture — identifying every limit you're hitting, every failure risk, and the fastest path to a reliable, scalable integration. Free audit. Findings delivered in 5 business days. No commitment required. We cover US EST, UK GMT, and AEST time zones.


Technologies Used

The Tools and Techniques Behind This Engagement

Salesforce Sales Cloud Lightning Web Components (LWC) Queueable Apex Apex HTTP Callouts Google Drive Resumable Upload API Google Drive Folder API Named Credentials Auth Provider Custom Object (Lynx Content Map) Salesforce Custom Button Base64 Chunk Processing Async File Upload Architecture Visual Studio Code

Salesforce Integrations That Actually Stay Inside the Limits — Delivered by Engineers Who've Seen Every Failure Mode.

Twopir has spent 12+ years solving the integration problems that standard Salesforce documentation doesn't warn you about — governor limits, async architecture, API session handling, and the custom data models needed to make it all stick. With 500+ clients across the US, UK, Australia, UAE, and Canada, we've built the patterns that scale.

12+ Years  ·  500+ Clients  ·  Salesforce Gold Partner  ·  HubSpot Gold Partner  ·  US  ·  UK  ·  Australia  ·  UAE  ·  Canada