Help Center Document Generation Generate from Reports

How to Generate Documents from Salesforce Reports with Dochly

Updated June 2026 8 min read Document Generation
Salesforce reports are one of the most powerful ways to define exactly which records receive a document — combining multiple filters, cross-object conditions, and date-range logic that would be complex to replicate elsewhere. This guide covers how to use any Salesforce report as the source for document generation with Dochly: how to prepare the report correctly, how to configure record matching, and how to run generation for every record the report returns.

Report generation vs record generation

Dochly supports two primary ways to identify which records to generate documents from — directly from a record, or from a Salesforce report. Understanding the difference helps you choose the right approach for each use case.

Record-level generation

Generate from a single Salesforce record — click the button on the record page, or trigger via a Flow when a specific record changes. Best for on-demand, one-at-a-time generation tied to a specific event.

Report-based generation

Use a Salesforce report to identify a set of records — generate one document per report row. Best when the records to generate for are defined by complex multi-field filters that span multiple objects or date ranges.

The key advantage of report-based generation is the report itself — you can use all of Salesforce's report filtering capabilities (cross-object filters, date ranges, formula-based conditions) to pinpoint exactly the right records. This is far more flexible than defining the same conditions in a Flow.


Supported report types

Not all Salesforce report types work as document generation sources. The report must return one row per record with a unique record ID that Dochly can use to identify the source record for each document.

Supported

Tabular reports

Simple flat list with one row per record. Most compatible format — Dochly reads each row as one generation. Recommended for most document generation use cases.

Supported

Summary reports

Grouped data with subtotals. Dochly generates from the detail rows — one document per record in the report detail rows, not one per group. Works when detail rows are unique records.

Not supported

Matrix reports

Two-dimensional grouping with column and row headers. Not supported as a document generation source — convert to Tabular or Summary format before using.

Supported

Joined reports

Multiple report blocks in one report. Supported with some limitations — Dochly generates from the primary report block. Ensure the primary block has unique record IDs.

Supported

Custom report types

Reports built on custom report types with custom objects. Fully supported as long as the report includes the Record ID column of the primary object matching the template.

Not supported

Analytic snapshots

Scheduled historical data snapshots. Not supported as a live generation source. Use a standard report against the same objects instead.


Preparing your Salesforce report

A report used for document generation needs to be set up correctly before you connect it to Dochly. These are the key preparation steps:

A

Use the correct report type (primary object must match template)

The report type determines which objects are available as filters and columns. The primary object in the report type must match the primary object of the template you plan to use. An Opportunity report → Opportunity template. An Account report → Account template.

If your template is based on a custom object, create a custom report type for that object if one doesn't already exist in your org.

B

Include the Record ID column and make it visible

The Record ID column is how Dochly identifies each record to generate from. Add it to your report columns:

  • In Report Builder, go to Columns
  • Search for "Opportunity ID" (or the equivalent for your object)
  • Add it to the report column list
  • Confirm it's visible — not hidden — in the report view

Without the Record ID column, Dochly cannot match report rows to Salesforce records and the generation will fail.

C

Set accurate filters to define exactly the right record set

The report filters define which records get a document. Every row the report returns will trigger a document generation. Use Salesforce's full filter capabilities:

  • Date range filters (e.g. Close Date = current month)
  • Field value filters (e.g. Stage = "Closed Won")
  • Cross-object filters (e.g. Account Type = "Customer")
  • Custom formula filters for complex conditions

Run the report and verify the row count before using it for generation. The row count = the number of documents that will be generated.

D

Save the report in a shared folder

Save the report in a public or shared Salesforce report folder — not in "My Private Reports". The user running document generation must have read access to the report. Private reports are not accessible to Dochly.


Step-by-step: generating documents from a report

1

Build and save your Salesforce report

Go to Salesforce Reports → New Report or open an existing report. Select your report type, add filters, configure columns, and verify the results. Save the report with a clear name that describes the record set — for example "Closed Won Opportunities — Current Month" or "Contracts Expiring in 60 Days".

2

Add the Record ID column to the report

In Report Builder → Columns, search for the ID field of your primary object (e.g. "Opportunity ID") and add it to the report. This column is required for Dochly to identify each record. Run the report and confirm the ID column is populated for every row.

3

Configure and verify report filters

Review your report filters carefully. Run the report and check the row count — this is the exact number of documents that will be generated. If the count is higher or lower than expected, adjust filters and run again until the results match your target set.

Do not proceed to Step 4 until the report row count matches your expectation exactly. Once generation starts, there is no undo.

4

Open Generate from Report in Dochly

Open the Dochly app from the Salesforce App Launcher. Navigate to Generate → From Report (or Batch Jobs → New → Report Source depending on your Dochly version). The report generation panel opens.

5

Select the report and template

In the report picker, search for and select the report you prepared. Dochly validates it immediately — showing the row count, confirming the ID column was detected, and verifying the report type is supported.

Then select the template to use for generation. Only Active templates with a matching primary object are shown. Confirm the template is the correct version before proceeding.

6

Configure output settings and run

Set the output format (PDF recommended), storage destination (attach to each record), and file naming convention. Optionally configure email delivery if documents should be sent to recipients automatically.

Review the final summary — record count, template, output, delivery — then click Generate. Dochly processes every record in the report and generates one document per row.

Monitor progress in the job status panel. You'll receive a completion notification with a success/failure summary when the job finishes.


Report filter strategies for common document workflows

The power of report-based generation is in Salesforce's filter capabilities. Here are the most useful filter patterns for common document generation workflows:

Monthly invoice run

Stage = "Closed Won" AND Close Date = this month AND Invoice_Status__c = "Pending". Runs at month-end to catch all deals closed in the current month that haven't been invoiced yet.

Renewal notices (60-day window)

Contract Status = "Active" AND End Date NEXT 60 DAYS. Automatically includes contracts entering the renewal window — the report updates daily without changes.

Onboarding packets (new customers)

Account Type = "Customer" AND Account Created Date = this week AND Onboarding_Sent__c = FALSE. Targets only new accounts that haven't received onboarding materials yet.

Compliance documentation (quarterly)

Case Status = "Closed" AND Case Closed Date = this quarter AND Case Type = "Regulatory". Generates case closure summaries for all compliance-related cases resolved this quarter.

Payment reminders (overdue)

Invoice_Due_Date__c < TODAY AND Payment_Status__c = "Unpaid" AND Days_Overdue__c > 7. Custom formula fields on the Opportunity enable precise overdue targeting.

Annual account statements

Account Type = "Customer" AND Account Status = "Active" AND Annual_Statement_Sent__c = FALSE. A checkbox field prevents the same account from receiving duplicate statements if the job runs more than once.


Report generation vs batch jobs — which to use?

Dochly offers two related but distinct features: Generate from Report (this guide) and Batch Document Jobs. Both use a Salesforce report as the source, but they serve different needs:

Feature Generate from Report Batch Document Job
Primary use case Ad hoc generation from any report Recurring, scheduled generation workflows
Scheduling Manual trigger only Can be scheduled to run automatically
Delivery options Basic — store or email Advanced — email, store, update record fields
Progress monitoring Basic progress indicator Detailed job log with per-record status
Best for One-time or occasional runs Monthly invoices, recurring compliance docs

For recurring workflows that run on a schedule, use Batch Document Jobs — they support scheduling, advanced delivery options, and per-record error logging. For one-time or ad hoc generation from a report, Generate from Report is simpler and faster to configure. See Run a batch document job from a Salesforce report.


Best practices

Always verify row count before generating

Run the report in Salesforce and check the row count before triggering generation. The row count equals the number of documents that will be generated. A misconfigured filter can lead to hundreds of unintended documents.

Use "prevention" fields in report filters

Add a checkbox field (e.g. Invoice_Sent__c) to your report filter — generate only where the field is FALSE, then update it to TRUE after generation. This prevents duplicate document generation on re-runs.

Keep report folders organized

Store document generation reports in a dedicated "Dochly Document Jobs" report folder. This makes them easy to find, share with the right users, and update when filter criteria change.

Test with a 5-record sample first

Before running a full generation, add a filter to the report to limit it to 3–5 specific test records. Run generation, verify the output, then remove the test filter for the full run.


Frequently asked questions

Joined reports are supported with limitations. Dochly generates from the primary report block only — the first block in the joined report. Ensure the primary block contains unique record IDs for the object matching your template. Cross-block filters in joined reports may not apply as expected — test with a small sample before full generation.
Ten records likely failed generation. Open the generation job status in Dochly and check the "Failed" count — click it to see which records failed and why. Common causes include empty required merge fields, missing related contacts, or field-level security restrictions for the generating user on specific records.
Yes. Salesforce relative date filters (This Month, Last 30 Days, Next 60 Days, etc.) work perfectly for recurring document generation. The report evaluates the filter at the time of generation — so a "Contracts expiring in 60 days" filter automatically shows the correct contracts each time the report is used, without manual updates to the date range.
No. The report only needs to include the Record ID column — Dochly uses the record ID to look up the full record data directly from Salesforce when generating each document. The report columns are used for filtering and identifying records, not for populating the document. All merge fields are resolved directly from the Salesforce record.

You can now use any Salesforce report as a document generation source — with full filter flexibility to target exactly the right records. Next in this series: How to generate a document from any Salesforce record with Dochly — how generation works across all standard and custom objects.

Dochly
Salesforce AppExchange — UTECH HUB Install Dochly on AppExchange

Rated 5 stars · Native Salesforce app · Free to install