How to Generate Documents from Salesforce Reports with Dochly
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.
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.
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.
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.
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.
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.
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.
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.
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:
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.
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.
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.
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
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".
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.
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.
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.
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.
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:
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.
Contract Status = "Active" AND End Date NEXT 60 DAYS. Automatically includes contracts entering the renewal window — the report updates daily without changes.
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.
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.
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.
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
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.
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.
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.
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
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.
Rated 5 stars · Native Salesforce app · Free to install