DocumentGenerationSetting defines an org's settings for automatic document generation from templates. It selects a document template library and controls generation location, preview format, guest-user authentication, and timeout handling for requests that remain in progress.
This configuration is separate from the templates themselves and from access to the server-side document generation feature. Deploying the settings does not prove that server-side generation is operational.
Key Elements
| Element | What the Element Controls |
|---|---|
documentTemplateLibraryName | Required. Names the library containing the document templates to which the setting applies. |
masterLabel | Required. Specifies the setting's label, such as DocGen. |
generationMechanism | Determines where generation runs. ClientSide, the default, generates documents in the browser with an optional preview. ServerSide generates documents on the server and attaches them to the objects for which they are generated. |
isServerSideDocGenEnabled | Controls server-side document generation enablement. Setting this flag alone does not satisfy the feature's licensing and access prerequisites. |
previewType | Controls preview format: PDF, the default, or Thumbnail. It does not select the generation location, and selecting a format does not itself establish that a preview is requested. |
guestAccessNamedCredential | Identifies the named credential used to let guest users generate documents. |
isInProgRqstTmotEnab | Enables or disables the timeout for in-progress document generation requests. |
inProgDocGenRqstTmot | Sets the timeout interval in hours when timeout handling is enabled. Valid values are whole numbers from 1 through 24; the default is 6. |
Behavior and Constraints
DocumentGenerationSetting is available only when the org has the DocGen platform license and the related add-on and user licenses.
Server-side document generation is not enabled by default. Setting isServerSideDocGenEnabled alone is insufficient: the org must also satisfy the prerequisites and access steps described in Salesforce's "Request Access to Server-Side Document Generation" article. Feature access and generationMechanism are separate concerns: one governs enablement, while the other determines where generation occurs.
previewType controls preview format only. PDF shows how the generated document looks in PDF format, while Thumbnail shows a miniature representation. Selecting either value does not itself establish that a preview is requested.
Read the two timeout fields together. When isInProgRqstTmotEnab is enabled, inProgDocGenRqstTmot specifies the interval after which InProgressDocumentGenerationProcess records are terminated and the request status becomes Failed. This applies to both single-point and batch requests. A populated timeout interval does not, by itself, mean timeout handling is active.
Deployment and Retrieval
In package.xml, address this configuration using metadata type Settings and member DocumentGeneration. Do not use DocumentGenerationSetting as the manifest type name.
There is one settings file for this settings component. Wildcard membership is not supported, so specify DocumentGeneration explicitly rather than using * when deploying or retrieving it.
The required configuration fields are documentTemplateLibraryName and masterLabel. The library name identifies the templates to which the configuration applies; it is not the setting's label.
Relationships
documentTemplateLibraryName connects the configuration to the library containing the applicable templates. guestAccessNamedCredential identifies the named credential for guest-user authentication. That authentication configuration is separate from both library selection and server-side feature enablement.
Documentation Inconsistencies
Salesforce's file-location guidance is ambiguous: it lists the suffix as documentGenerationSetting and the directory as documentGenerationSettings, but also describes the component as a .settings file. The manifest identity is explicit: use member DocumentGeneration under type Settings.
Common Questions
How do I retrieve DocumentGenerationSetting with package.xml?
Use Settings as the metadata type and DocumentGeneration as the member. Wildcard membership is not supported.
Why doesn't isServerSideDocGenEnabled enable server-side document generation?
The flag alone is insufficient. The org needs the required DocGen licenses and must complete the server-side document generation prerequisites and access steps.
Does previewType determine whether documents are generated on the server?
No. generationMechanism determines generation location. previewType selects PDF or Thumbnail format; selecting a format does not itself establish that a preview is requested.
What happens when an in-progress document generation request times out?
When timeout handling is enabled, the configured interval causes the associated InProgressDocumentGenerationProcess records to be terminated and the request status to become Failed. The interval applies to single-point and batch requests, accepts whole hours from 1 through 24, and defaults to 6 hours.