---
isPublished: true
knowledgeIndex: false
hidden: true
noindex: true
template: "page.peb"
title: "Generate XP Document Flow Action"
description: "Inputs, outputs, callouts, record effects and transaction guidance for the DialogueOne Generate XP Document Flow action."
contentType: "reference"
audience: "admin,developer"
seoTitle: "Generate XP Document Flow Action Reference"
seoDescription: "Generate an XP document and PDF from Salesforce Flow, check its confirmed references and pass generated Content to Create Experience."
---

# Generate XP Document

Use **Generate XP Document** to generate a document from a published XP template and save its PDF as a Salesforce File.
The namespaced Apex action name is `rooms__GenerateXPDocumentAction`.

This action returns the generated Content ID required by
[Create Experience](/content/build/flows/CreateExperienceAction.md).
The [Generate Document](/content/build/flows/CreateDocumentAction.md) action has a different output contract.

## Transaction summary

| Effect | Behavior |
| --- | --- |
| API callout | Yes. The action waits for the generation result. |
| Record writes | Requests a generated `rooms__Content__c` record, a saved PDF File version and the File's record link. The action does not directly insert, update or delete records in the calling Flow transaction. |
| Platform event | The action does not directly publish a platform event. |
| Email | The action does not send email. |
| Background work | This action returns a generation result. It has no Run Asynchronous input. |

Earlier record writes or other pending work can prevent the callout.
Do not assume that a later Flow fault removes a document or File that was already created.

## Inputs

| API name | Flow label | Required | Default or guidance |
| --- | --- | --- | --- |
| `recordId` | Source Record ID | Yes | The Salesforce record to merge. It must match the published template's target object. |
| `templateContentId` | Published XP Template Content ID | Yes | The active, current, published template's `rooms__Content__c` ID. Do not supply a template File ID. |
| `parentId` | PDF Attachment Parent ID | No | Defaults to `recordId`. Select the record that must receive the PDF File. |
| `fileName` | PDF File Name | No | Uses the published template's output filename when blank. |
| `title` | Document Title | No | Uses the published template's output filename when blank. |

## Outputs

| API name | Flow label | Meaning |
| --- | --- | --- |
| `success` | Success | `true` confirms the generated document, saved PDF and Content references. |
| `message` | Message | Result details, warnings or an error. |
| `documentId` | XP Document ID | The generated document identifier. It is not a Salesforce Content record ID. |
| `revisionId` | XP Revision ID | The generated document revision. |
| `contentRecordId` | Instance Content ID | The generated `rooms__Content__c` ID. Pass this value to Create Experience. |
| `contentDocumentId` | PDF ContentDocument ID | The Salesforce File ID (`069`). |
| `contentVersionId` | Exact PDF ContentVersion ID | The exact saved PDF File version ID (`068`). |
| `renderedRevisionId` | Rendered XP Revision ID | The document revision used for the PDF. It must match XP Revision ID for a successful result. |
| `recordId` | Source Record ID | The source record used for generation. |
| `parentId` | PDF Attachment Parent ID | The record selected to receive the PDF File. |
| `fileName` | PDF File Name | The PDF output filename. |

A false result can still contain confirmed identifiers from completed work.
Keep these outputs for investigation. An identifier alone does not replace the Success check.

## Configure the Flow

1. Select the source record and its published XP template.
2. Add **Generate XP Document** from the Apex action list.
3. Map Source Record ID and Published XP Template Content ID.
4. Set the optional parent, filename and title.
5. Review the action's Advanced transaction setting for the Flow type.
6. Store Success, Message and all document, Content and File identifiers.
7. Add a Decision that continues only when Success equals `true`. Connect the action's Fault path.
8. For Experience creation, map Instance Content ID to Primary Document Content ID.

```mermaid
flowchart TD
    A[Select source record and published XP template] --> B[Generate XP Document callout]
    B --> C{Success is true?}
    C -- Yes --> D[Use saved PDF and generated Content ID]
    C -- No --> E[Keep confirmed IDs and inspect existing results]
    B -- Fault --> E
```

Confirm the Flow user's action access and the required source-record, template and File access.
Review the configured Salesforce API connection user's access.
See [XP access and permissions](/content/support/xp-permissions.md).

## Troubleshooting

**You have uncommitted work pending.** This action makes an API callout.
Check record writes and other pending work before the action in the same transaction.
Review [transaction settings and debugger limits](/content/build/flows/index.md#resolve-uncommitted-work-pending).

**The template is rejected.** Select the published template's Content record, not its File or a generated document.
Confirm that the template is active, current and published. Its target object must match Source Record ID.
Republish a template whose saved File and version references are invalid.

**The response is unsuccessful, incomplete or unreadable.** Read Message and inspect related Files, Content and DialogueOne Events.
Preserve confirmed output IDs. Generation or File creation can complete before a response fails.
Do not repeat generation until you confirm whether the requested document already exists.

**The wrong identifier is passed to Create Experience.** Use `contentRecordId`.
Do not use `documentId`, `revisionId`, `contentDocumentId`, `contentVersionId` or the template's Content ID.

**Email fails later.** Keep the generated document and confirmed Experience link.
Retry the email step with the same link after checking the send result.
Do not regenerate the document as an email retry.

See the [single-signer quote Flow XML](/assets/flows/v2.166/IDialogue_Single_Signer_Quote.flow-meta.xml)
and [Flow action index](/content/build/flows/index.md) for the complete sequence.
