For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to Create Dynamic File Names

Use merge fields in Output File Format to generate clear, searchable file names automatically.

Use dynamic file names to replace generic outputs like SD-0001.pdf.

This makes files easier to sort, search, and identify in Salesforce.

Set the output file name

1

Open document options

Open the Document Options tab in the Template Editor.

2

Find the file name setting

Locate Attachment & File Name Options.

3

Enter the naming formula

Add your formula in Output File Format.

4

Save and test

Save the template.

Generate a test document.

Common naming patterns

Use case
Formula
Example output

Sales quotes

Quote-{!Opportunity.Name}-{!TODAY()}.pdf

Quote-Q1 Services-2024-02-04.pdf

Invoices

INV-{!Opportunity.InvoiceNumber__c}.pdf

INV-12345.pdf

Contracts

Contract-{!Opportunity.Account.Name}.pdf

Contract-Acme Corp.pdf

Reports

{!Account.Name}-Report-{!TODAY()}.pdf

Acme-Report-2024-02-04.pdf

Best practices

  • Avoid /, \, :, *, ?, ", <, >, and |.

  • Use hyphens or underscores instead of spaces.

  • Keep names under 80 characters when possible.

  • Put the most important value first.

Tips

Include record context

Start with the document type, record name, or ID.

This improves sorting in related lists and external storage systems.

Add a date when needed

Use {!TODAY()} for time-based versioning.

This helps when users generate multiple copies over time.

Keep names stable

Avoid long formulas with optional fields unless you need them.

Shorter names are easier to scan.

Last updated

Was this helpful?