Help Center Batch Processing Set Up Batch Processing

Set Up Batch Document Processing in Salesforce with Dochly

Updated June 2026 8 min read Batch Processing
Batch document processing generates documents for hundreds or thousands of Salesforce records in a single automated operation — no manual record-by-record clicks, no user action required. Dochly delivers this through two Flow actions rather than a dedicated console: Dochly: Generate Documents (Bulk - Collection) and Dochly: Generate & Email Documents (Bulk - Collection). This guide covers everything you need to configure before running your first batch: permissions, the record-source query, the Flow action inputs, storage, delivery, and how to build in notifications.

What batch processing is

Batch processing in Dochly takes a collection of Salesforce record Ids — often built from a Get Records element in Flow using the same filters you'd put on a Salesforce report — and generates a personalised document for every record in that collection in one call. Each document is unique, populated with the live data from its individual Salesforce record, and stored back on that record automatically.

The key difference from single document generation is scale and automation: instead of opening each record and clicking Generate, a single call to the bulk Flow action handles up to 2,000 records at once, running asynchronously in the background while your team continues working.

Without batch

Manual generation

  • Open each Salesforce record individually
  • Click Generate Document on every record
  • 50 invoices = 50 separate clicks and waits
  • Easy to miss records or generate inconsistently
  • Requires user presence throughout
With batch

Batch processing

  • One record Id collection defines all target records
  • One Flow run (manual or scheduled) starts the entire batch
  • 50 invoices = same call as 500 invoices (up to 2,000 per call)
  • Consistent output — same template, same settings
  • Runs asynchronously — no user presence needed

When to use batch vs single generation

Use batch when

You need to generate the same document type for more than 5–10 records at once. The records share a common filter (same month, same status, same region). The operation is recurring — monthly invoices, quarterly reports, annual renewals. Speed and consistency matter more than per-document customisation at send time.

Use single generation when

Generating one document for a specific record in an active deal workflow — e.g. a sales rep generating a proposal for a customer they're about to call. The document requires per-send customisation (specific signer, custom message, override settings). The record count is small enough to handle manually.


Common use cases

Monthly

Invoice run for all Closed Won deals

Generate and send invoices for every Opportunity closed this month in a single end-of-month batch operation.

Annual

Contract renewal pack for all active accounts

Generate personalised renewal agreements for every active Account contract expiring in the next 90 days.

Compliance

Policy acknowledgement distribution

Generate and send policy documents to all Contacts who haven't acknowledged an updated terms or compliance notice.

HR

Employee document batch

Generate onboarding packets, handbook acknowledgements, or benefit summaries for all employees who joined this quarter.

Quarterly

Account statement generation

Generate quarterly account summaries for all active Accounts, storing each statement on the Account record automatically.

Ad hoc

Bulk data export to PDF/Word

Generate formatted reports from a Flow-built record set — converting CRM data into branded, distributable documents at any scale.


Prerequisites

Confirm these are in place before building your batch Flow:

Dochly installed and connected

Dochly must be installed and the connection status must be green. Batch Processing requires a connected Dochly instance — Setup Wizard must have been completed successfully. See Install Dochly from AppExchange.

Dochly Admin permission set

Building and activating a batch Flow requires the Dochly Admin permission set. Verify it's assigned: Setup → Users → [Your User] → Permission Set Assignments. The Dochly User permission set is not sufficient for creating or modifying Flows that call the bulk actions.

At least one Active template

The bulk actions require an Active Dochly template Id to generate from. Confirm at least one template is set to Active status in Dochly → Templates before building a batch Flow. Draft templates cannot be used in batch runs.

A record-source query ready

Dochly's bulk actions take a collection of record Ids as input — there's no report-picker UI. Plan the Get Records filters your Flow will use (you can model these on an existing Salesforce report that shows the same records) and confirm they return the record set you expect.


Setup walkthrough

1

Confirm permissions and access

Batch processing is triggered from Salesforce Flow, not from a dedicated console — there is no "Batch Jobs" tab in the Dochly app. Confirm instead that your user has the Dochly Admin permission set assigned (Setup → Users → [Your User] → Permission Set Assignments), which is required to build and activate Flows that call Dochly's bulk actions.

Also confirm the running context of the Flow (the user it runs as, or "System Context Without Sharing" for admin-triggered automations) has at minimum the Dochly User permission set, plus access to the two bulk actions: Dochly: Generate Documents (Bulk - Collection) and Dochly: Generate & Email Documents (Bulk - Collection).

2

Build the record-source query

Before adding the bulk action, build the part of your Flow that gathers the target records. This is typically a Get Records element (optionally inside a loop) that collects record Ids into a collection variable. Design the filters the same way you would design a Salesforce report:

  • Query the same object as your template's primary object
  • Store the results as a collection of record Ids (not full records) — this is what the bulk action expects
  • Use relative date filters where applicable ("This Month", "Last 90 Days") so the Flow stays relevant on re-runs without manual updates
  • Cap the collection at 2,000 Ids per call to the bulk action — split larger sets into multiple calls within the same Flow, or across multiple scheduled runs

Test the Get Records element on its own first and check the resulting collection size in Flow debug mode — every Id in the collection becomes one document generation, so confirm there are no unexpected records before calling the bulk action.

3

Configure the Flow action

Add the Dochly: Generate Documents (Bulk - Collection) action (or the Generate & Email variant) to your Flow and wire up its inputs:

Flow action inputs

Required
Record Id collection

The collection variable you built in Step 2 — up to 2,000 record Ids per call.

Template Id

The Id of the Active Dochly template to generate from. Pass it as a text input — hardcode it for a fixed template, or look it up with a Get Records on the Dochly Template object if the Flow needs to select a template dynamically.

Recommended: match the template's object type to the Id collection's object type
Throughput and retries

Speed and safety are governed by package custom metadata, not a UI concurrency picker: Bulk_Cap (max records per call), Chunk_Size (records processed per internal sub-batch), Async_Threshold (size above which the action runs asynchronously — the default for these bulk actions), Retry_Count, and Stuck_Row_Recovery_Minutes. Most orgs should leave the default custom metadata values as-is; adjust them only if you hit a specific throughput issue.

Recommended: leave default custom metadata values unless you have a specific throughput issue
4

Configure delivery and storage

Storage and delivery

Required
Storage destination

Not configurable — generated documents are always stored as a Salesforce File on the record they were generated from, in that record's Files related list.

Email delivery

To email each document as it generates, use Dochly: Generate & Email Documents (Bulk - Collection) in place of the plain generation action. It accepts the same record Id collection and Template Id, and sends each generated document to the record's configured recipient.

Optional — swap the action, not a toggle
Post-generation field update

Add your own step after the bulk action call to update a field on each processed record (e.g. Invoice_Sent__c = TRUE) once the batch has actually finished — check the DH_Generation_Batch__c record's Status field first, since the bulk actions run asynchronously and the Flow continues before generation completes.

Recommended: use a Get Batch Status check (or a scheduled follow-up Flow) before updating records
5

Build in notifications

Dochly does not have a built-in notifications settings screen for batch runs — notifications are something you add to your Flow:

  • Completion email: After calling the bulk action, add a path that calls Dochly: Get Batch Status with the returned batchId (directly, or after a Wait/scheduled path), and once isFinished is true, use a Send Email action to notify an admin with total/completed/failed/cancelled counts
  • Failure alerts: Add a Decision element on the Status output (Failed or Completed With Errors) to trigger an immediate alert email or Chatter post rather than waiting for full completion
  • Progress checks: Optional — build a separate Scheduled-Trigger Flow that periodically calls Dochly: Get Batch Status on open DH_Generation_Batch__c records to report progress at intervals
6

Run a test batch with 5 records

Before running a full production batch, test your Flow with a small subset. Constrain the Get Records element from Step 2 to return only 3–5 records (use a specific Account name or date range to limit scope). Run the Flow and verify:

  • Documents generate and attach to each record's Files list
  • The DH_Generation_Batch__c record's Total/Completed/Failed/Cancelled fields match what you expect, and Status reaches Completed
  • Email delivery works if you used the Generate & Email variant — check that test recipients receive the email
  • Any post-generation field updates you built are applied correctly

Once the test confirms correct behaviour, widen the Get Records filters to their full production criteria and run the full batch.


Batch size and governor limits

Dochly's bulk actions run outside the Salesforce synchronous transaction context by default (governed by the Async_Threshold custom metadata setting) — which means they avoid the most restrictive Governor Limits that affect synchronous operations. However, some limits still apply.

Recommended batch sizes

Up to 2,000 records: this is the hard cap per call to Dochly: Generate Documents (Bulk - Collection) or the Generate & Email variant. Up to 500 records: runs smoothly with default Bulk_Cap/Chunk_Size settings. Over 2,000 records: split the Id collection and call the action multiple times in a loop, or spread the calls across multiple scheduled Flow runs using a native Scheduled-Trigger Flow (see Schedule a batch document run).

Processing time

50 records: approximately 1–3 minutes. 500 records: approximately 10–20 minutes. 2,000 records: approximately 30–90 minutes depending on template complexity and the Chunk_Size custom metadata setting. Large batches run asynchronously in the background — close the browser and check back via the DH_Generation_Batch__c record.

Email delivery limits

Salesforce limits outbound emails to 5,000 per day for most orgs. If your batch run emails documents to more than 5,000 recipients in a day, split the run across multiple days or use Salesforce's Mass Email feature for very large volumes.

Storage consumption

Each generated document consumes Salesforce File storage. A 200KB PDF × 1,000 records = ~200MB of storage. Monitor Salesforce storage usage (Setup → Storage → File Storage) before running large batches to avoid hitting org storage limits.


Frequently asked questions

Dochly's bulk actions don't consume a Salesforce report directly — there's no report-picker UI. Instead, build your Flow's Get Records element with the same filters the report uses (e.g. "Stage = Closed Won AND Close Date = This Month"), so the Id collection you pass to the action matches exactly the records the report would show. This gives you the same control a report-based picker would, expressed as Flow logic instead.
Yes, multiple calls to the bulk actions can run simultaneously. Each call runs independently in its own async context. Running multiple large batches at the same time increases total Salesforce API usage — if you have large batches, stagger them by 30–60 minutes to avoid API limit collisions. Build a report or list view on the DH_Generation_Batch__c object filtered to Status = In Progress to see everything currently running across the org.
Check the DH_Generation_Batch__c record's Completed and Failed counts to see how far the run got. If you configured a post-generation field update (e.g. Invoice_Sent__c = TRUE), already-processed records are naturally excluded from a re-run because they no longer match your Get Records filter. Without a prevention field, you would need to build a targeted Id collection (e.g. the failed or unprocessed records) before calling the bulk action again.

Batch processing is now configured and ready to run. Next in this series: Run a batch document job from a Salesforce report — build the Flow, configure the record source and template, and launch the generation run.

Dochly
Get Early Access Contact Us to Get Started with Dochly

Not on AppExchange yet — contact us and we'll set you up