When merging documents in Salesforce that include file attachments, you may encounter size limitations that prevent files from being included in your generated documents. Salesforce's Apex heap size limits restrict file transfers to 6MB (synchronous) or 12MB (asynchronous), which can block larger attachments like high-resolution images.
The Large File Upload feature solves this problem by changing how files are transferred. Instead of Salesforce pushing files to Formstack Documents, which hits the heap limit, Formstack Documents pulls files directly from Salesforce. This eliminates the heap size restriction and supports attachments up to 2GB per file without requiring any changes to your existing templates or merge logic. With this feature enabled, you can:
- Include large attachments in your document merges without hitting Salesforce's 6MB/12MB limits
- Merge multiple files without worrying about file size (up to 2GB per file)
- Maintain security by eliminating the need for insecure workarounds like temporary public file URLs
- Use existing templates without modification; your merge fields work exactly as before
Setup Requirements
Before you can use large file uploads, you need to complete two setup steps:
Step 1: Add Salesforce as a Delivery Account in Formstack Documents
- In Formstack Documents, click the user in the top right navigation
- Select Delivery Accounts
- Click Login to Salesforce and choose Production or Sandbox
- Log in to the Salesforce account
- Verify your Salesforce account appears in the delivery accounts list
Step 2: Enable Large File Upload in Salesforce
- In Salesforce, navigate to Formstack Settings
- Locate the Large File Upload section
- Check the Enable Large File Upload checkbox
- From the dropdown menu, select the Salesforce delivery account you just added in Formstack Documents
- Click Save Settings
The feature is now active for your org.
How to Use Large File Attachments
Once enabled, large file upload works automatically with your existing merge configurations. No changes are needed to how you set up or run merges.
Important Limitations
Keep these limitations in mind when working with large files:
- Maximum total file size: 2GB per file
- User permissions matter: The Salesforce user account selected in delivery settings must have access to view the files you're merging. If they don't have permission, the file won't be retrieved.
- API rate limits apply: Salesforce API usage limits still apply. If you're generating many documents with large attachments simultaneously, consider staggering your merges to avoid hitting rate limits.
- This feature requires your Documents for Salesforce application to be on version 1.363 or later.
Troubleshooting
| Issue | Likely Cause | How to Fix |
|---|---|---|
| File not retrieved or showing as blank | Selected Salesforce user lacks file permissions | Re-authenticate with a Salesforce user who has access to the files, or update file sharing settings in Salesforce |
| Token decryption error | Incorrect encryption setup between Formstack Documents and Salesforce | Verify your delivery account authentication. Try removing and re-adding the Salesforce account in Formstack Documents |
| API rate limit exceeded | Too many merges are running at once | Implement delays between document generation jobs, or reduce the number of simultaneous merges |
| Incomplete attachments | File fetch failed without a clear error | Check API response logs in Salesforce or enable retry logic in your automation |