Create PDF Document
Use the Create PDF Document step to generate a PDF from a Business Central report and store it as a document in the AutoFlow document library. The step produces a reference to the created document, so any subsequent step can access it directly.
Typical use cases include:
- Generating an invoice PDF from your sales invoice report and attaching it to an email.
- Creating a delivery note for a shipment and archiving it in the document library.
Configure the step
Open the flow editor, add Create PDF Document, and fill in the configuration page.
Description
- Purpose: Describe what this step does in the context of your flow.
- When to fill it: Always. The description appears in the editor and execution history.
- Tips: Include the report name and intent, for example
Generate Sales Invoice PDF.
Record Selector
- Purpose: Points to the record that the report should run against.
- When to fill it: Optional. Fill it for reports that need a source record (e.g. a sales invoice or a shipment). Leave it empty for reports that build their data from filters and request-page options alone – typical examples are financial reports such as Trial Balance, G/L Register, or balance-sheet style overviews.
- How it works: Use the SmartField picker to insert a placeholder pointing to a record reference (for example
{{trigger_record}}). The selector uses the standard{{name}}notation – paste the picker's output as-is. - Tips: When set, the record selector must point to a reference-type field, not a value. If the selector cannot be resolved when the step runs, the step will produce a clear error message.
Report
- Purpose: The Business Central report used to generate the PDF.
- When to fill it: Required. Without a report, no PDF can be created.
- How it works: Click the assist button to open the report lookup. Only reports with an ID below 2,000,000,000 are shown.
- Tips: Make sure the selected report supports PDF output. Not all report layouts render well as PDF.
Layout
- Purpose: Choose which layout the report is rendered with — for example a Word layout instead of an RDLC layout, or a customer-specific layout.
- When to fill it: Optional. Leave it empty to use the report's default layout. This is the same behaviour as before, so existing flows are unaffected.
- How it works: Pick a report first, then click the assist button to choose from the layouts available for that report. Both built-in and user-defined layouts are listed.
- Tips:
- Word and RDLC layouts render directly to PDF. Excel and custom layouts can also be selected, but the PDF result may vary depending on the layout.
- Use Clear layout to go back to the report's default.
- Changing the report resets the layout, because a layout belongs to a specific report.
- If the chosen layout is later removed or renamed in Business Central, the step reports a clear error so you can pick another one.
Report Parameters
- Purpose: Default parameters for the report request page (filters, options, etc.).
- When to fill it: Optional. Use this when the report needs specific filter settings.
- How it works: Click the assist button to open the report's request page. The parameters are saved and applied automatically when the step runs.
- Tips: You can update the parameters at any time by clicking the assist button again. Use Clear report parameters to drop the saved configuration and run with report defaults next time.
Edit XML
After parameters are configured, the Edit XML action opens a separate editor with the raw request-page parameters. Use this when you want to splice SmartField placeholders into the parameters so the report runs with runtime values from the flow.
Placeholders use the same {{slug.output}} syntax as the rest of the flow editor. Press Alt+S in the editor to open the SmartField picker; the chosen placeholder is copied to the clipboard so you can paste it at the cursor.
Mutual exclusivity with the request page. Once SmartField placeholders are saved into the XML, the request-page editor can't reopen the parameters — it would try to parse the placeholders as typed XML values and fail. The Report Parameters assist edit auto-routes to Edit XML once placeholders are detected. To go back to the request page, use Clear report parameters first.
Typed fields. Substituted values are inserted into the XML verbatim. Text fields are forgiving; typed fields (Date, Decimal, Boolean, Integer…) require the value in BC's request-page format or the report fails with a NavType-style parse error. Use a SmartField inline format suffix ({{name;9}}) — ;9 is BC's XML format, which is what the request-page parser expects:
<Field name="StartDate">{{trigger.postingDate;9}}</Field>
That emits 2026-05-26 for a Date, 1234.56 for a Decimal, true/false for a Boolean.
Filename Pattern
- Purpose: Controls the filename of the generated PDF document.
- When to fill it: Optional. If left empty, a default name is used (
Report_{ReportId}.pdf). - How it works: Use placeholders to build dynamic filenames:
{ReportName}— The caption of the selected report.{RecordNo}— The primary key value of the source record.{ReportId}— The numeric ID of the report.
- Example:
{ReportName}_{RecordNo}.pdfproducesSales Invoice_1001.pdf.
Output
The step returns a single reference output:
Document: A reference to the newly created record in the Document table (mse365 AF Document).
Use this output in subsequent steps by referencing it through the step slug, for example pdfprint_Document. Because it is a reference output, later steps can resolve the full document record — including its name, content type, length, and binary data.
What happens when the step runs
- The step reads the configured report ID, selector (if any), parameters, layout (if any), and filename pattern.
- It validates that the report exists, that the chosen layout (if any) still exists for that report, and – when a selector is set – that it resolves to a valid record. With no selector, the report runs without a record scope and uses only the configured parameters.
- The report is rendered as PDF into an in-memory stream, using the selected layout when one is set, or the report's default layout otherwise.
- A new document record is created in the AutoFlow document library with the PDF content, filename, and content type
application/pdf. - The document's record ID is emitted as a reference output.
The created document is visible on the Documents page and persists independently of the flow execution.
Best practices
- Set a meaningful filename pattern: Default filenames like
Report_206.pdfare hard to identify later. Use{ReportName}_{RecordNo}.pdffor clarity. - Validate the selector: If you use a dynamic selector from a previous step, make sure that step always produces a record reference.
- Chain with email or archive steps: The document reference can be used by any step that accepts a record selector — for example, to attach the PDF to an email or copy it to an external system.
- Check the Documents page: After running a flow, verify that the generated document appears in the document list with the expected name and size.