> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/developer-hub/document-workflows/flow-reference.md).

# Flow Reference

Use this page when you need the right S-Docs action in **Flow Builder**.

#### Architectural context and limits

Design these actions around transaction boundaries first.

These invocable actions are Apex-backed actions executed by Flow.

Treat them as production transaction participants.

#### Bulkification behavior

* Flow can invoke Apex actions with `List<Input>` payloads in bulk contexts.
* Architect flows for bulk entry points first.
* Do not assume each action batches SOQL, DML, or callouts safely.
* Avoid calling these actions inside deep loops.
* Prefer collection-based handoff when available.
* Use **Generate Documents in Batch** for high-volume runs.
* Use batch generation when you need queued execution or fresh governor context.
* Prefer `SDOC__GenerateBatchInvocable` when one flow can fan out across many records or templates.

#### Error handling and fault paths

* Use Flow **Fault** paths on every action.
* Treat failures as Apex exceptions in the Flow transaction.
* Do not treat outputs as a general error channel.
* Do not assume every action exposes a standard error output contract.
* For asynchronous actions, a successful Flow step only confirms queueing.
* Monitor queued jobs separately for runtime failures.
* Persist failure context when possible.
* Log record ID, action name, interview ID, and exception message when possible.

#### Transaction and callout constraints

* A flow can fail after DML and then a callout.
* Salesforce can throw `uncommitted work pending` in that pattern.
* Split transaction phases explicitly when chaining envelope actions.
* Use a **Screen**, **Pause/Wait**, or **Asynchronous Path** when needed.

> **Architectural warning:** A flow that works for one record can still fail at scale because of callout timing, CPU time, heap size, or SOQL limits.

#### Invocable Actions List

* [Generate Document](#generate-document) — Generate one document from one base record.
* [Send Email](#send-email) — Send documents with an S-Docs email template.
* [Generate S-Doc With Input](#generate-s-doc-with-input) — Pass Screen Flow inputs into generation.
* [Prepare Envelope](#prepare-envelope) — Build the envelope payload for signing.
* [Seal Envelope](#seal-envelope) — Finalize the envelope and return the signing link.
* [Refresh Document Data](#refresh-document-data) — Refresh an existing S-Doc with current record data.
* [Generate Documents in Batch](#generate-documents-in-batch) — Queue bulk generation across many records or templates.
* [Combine Documents](#combine-documents) — Merge multiple S-Docs into one combined output.
* [Create PDF File from S-Doc](#create-pdf-file-from-s-doc) — Convert an S-Doc record into a PDF file.

#### Related Flow Screen Components

Use these when a Flow step needs user interaction.

* [Live Edit Screen](#live-edit-screen) — Let users edit a generated document in a Flow screen.
* [Email Editor Screen](#email-editor-screen) — Let users review email content in a Flow screen.
* [Document Viewer Screen](#document-viewer-screen) — Let users view an S-Doc PDF in a Flow screen.

***

## Invocable Actions List

###

### Generate Document

Use this action to generate one document from one base record.

* **Flow Builder label:** Generate Document
* **API name:** `SDOC__GenerateDocumentInvocable`
* **Common output:** `sdocId`
* **Notes:** Supports guest-user generation in Experience Cloud.
* **Notes:** Supports component templates with `<LineItems>` related lists.
* **Implementation guide:** Use [Getting Started: Automate Document Generation](/quick-start/document-generation/getting-started-automate-document-generation.md) for org-level generation patterns.

#### Inputs

| Name                  | Type      | Required | Max Occurs | Label                                     | Description                                                                                                |
| --------------------- | --------- | -------: | ---------: | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `enforceSharingRules` | `BOOLEAN` |       No |          1 | System Mode Generation (Experience Cloud) | Grants unauthenticated or logged-in Experience Cloud users system-level permissions for generation events. |
| `recordId`            | `ID`      |      Yes |          1 | Base Record ID                            | ID of base record used in generation.                                                                      |
| `templateId`          | `ID`      |       No |          1 | Template ID                               | If selecting by template name, do not use this field.                                                      |
| `templateName`        | `STRING`  |       No |          1 | Template Name                             | Name of template used in generation.                                                                       |

#### Outputs

| Name                | Type     | Max Occurs | Label                        | Description                      |
| ------------------- | -------- | ---------: | ---------------------------- | -------------------------------- |
| `contentDocumentId` | `STRING` |          1 | Generated ContentDocument ID | ID of generated ContentDocument. |
| `fileName`          | `STRING` |          1 | Generated File Name          | Name of generated file.          |
| `sdocId`            | `STRING` |          1 | Generated SDoc ID            | ID of generated SDoc.            |

**Technical specifications and best practices**

* **Execution context:** **Synchronous.** Document generation consumes limits in the active transaction.
* **Data formatting:** Provide either `templateId` or `templateName` consistently.
* **Data formatting:** Avoid setting both unless your org-standard wrapper defines precedence.
* **Experience Cloud behavior:** `enforceSharingRules` toggles system-mode behavior for Experience Cloud generation paths.
* **Fault handling:** Use Flow **Fault** paths for exceptions.
* **Apex SDK equivalent:** Use S-Docs generation APIs in Apex when you need custom pre-validation, branching, or transaction orchestration.

***

### Send Email

Use this action to send documents with an S-Docs email template.

* **Flow Builder label:** Send Email
* **API name:** `SDOC__EmailInvocable`
* **Common output:** `sendSuccessful`
* **Notes:** Supports guest-user generation in Experience Cloud.
* **Implementation guide:** Use [Send Email from Flow](/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-email-generation-updated.md) for email template, attachment, and delivery setup.

#### Inputs

| Name                  | Type      | Required | Max Occurs | Label                                     | Description                                                                                                |
| --------------------- | --------- | -------: | ---------: | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `attachmentIds`       | `ID`      |       No |       2000 | Attachments                               | ID(s) of attachment(s) to include in the email.                                                            |
| `bccAddress`          | `STRING`  |       No |       2000 | BCC Recipient Email Address               | BCC address(es) to send the email to.                                                                      |
| `ccAddress`           | `STRING`  |       No |       2000 | CC Recipient Email Address                | CC address(es) to send the email to.                                                                       |
| `enforceSharingRules` | `BOOLEAN` |       No |          1 | System Mode Generation (Experience Cloud) | Grants unauthenticated or logged-in Experience Cloud users system-level permissions for generation events. |
| `orgWideAddress`      | `STRING`  |       No |          1 | Org-Wide Email Address                    | Org-wide address of the email.                                                                             |
| `recordId`            | `ID`      |      Yes |          1 | Base Record ID                            | ID of base record to be used with template.                                                                |
| `subject`             | `STRING`  |       No |          1 | Subject Line                              | Subject of the email.                                                                                      |
| `templateNameOrId`    | `STRING`  |      Yes |          1 | S-Docs Email Template Name or ID          | Name or ID of template to be used in the email.                                                            |
| `toAddress`           | `STRING`  |       No |       2000 | Recipient Email Address                   | Address(es) to send the email to.                                                                          |

#### Outputs

| Name             | Type      | Max Occurs | Label           | Description                                        |
| ---------------- | --------- | ---------: | --------------- | -------------------------------------------------- |
| `sendSuccessful` | `BOOLEAN` |          1 | Send Successful | Indicates whether the email was successfully sent. |

**Technical specifications and best practices**

* **Execution context:** **Synchronous.** Email composition and send logic executes in the current transaction context.
* **Data formatting:** Multi-value inputs use repeatable values.
* **Data formatting:** Use **Flow Text Collections** for `attachmentIds`, `toAddress`, `ccAddress`, and `bccAddress`.
* **Template resolution:** `templateNameOrId` is required.
* **Template resolution:** Combine it with `recordId` to resolve merge context deterministically.
* **Fault handling:** Even though `sendSuccessful` is returned, wire a Flow **Fault** path.
* **Apex SDK equivalent:** Use S-Docs email Apex APIs when you need advanced recipient validation, conditional attachments, or custom delivery telemetry.

***

### Generate S-Doc With Input

Use this action to pass Screen Flow inputs into generation.

* **Flow Builder label:** Generate S-Doc With Input
* **API name:** `SDOC__UserInputInvocable`
* **Common output:** `sdoc`
* **Notes:** Supports guest-user generation in Experience Cloud.
* **Notes:** Use `sdoc.Id` in later Flow steps when you need the generated record ID.
* **Implementation guide:** Use [User Input](/sdocs/automation-and-document-lifecycle/automate-with-flow/pass-screen-flow-inputs-into-pdfs.md) to define and map runtime inputs.

{% hint style="info" %}
If you need setup steps for `userInputs`, use [User Input](/sdocs/automation-and-document-lifecycle/automate-with-flow/pass-screen-flow-inputs-into-pdfs.md).
{% endhint %}

#### Inputs

| Name                  | Type                            | Required | Max Occurs | Label                                     | Description                                                                                                |
| --------------------- | ------------------------------- | -------: | ---------: | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `enforceSharingRules` | `BOOLEAN`                       |       No |          1 | System Mode Generation (Experience Cloud) | Grants unauthenticated or logged-in Experience Cloud users system-level permissions for generation events. |
| `objectId`            | `ID`                            |      Yes |          1 | Object Id                                 | ID of object used in generation.                                                                           |
| `templateNameOrId`    | `STRING`                        |      Yes |          1 | Template Name or Id                       | Name or ID of template used in generation.                                                                 |
| `userInputs`          | *(unspecified by API metadata)* |      Yes |       2000 | User Inputs                               | User inputs for merge fields used in generation.                                                           |

#### Outputs

| Name   | Type      | Max Occurs | Label               | Description                     |
| ------ | --------- | ---------: | ------------------- | ------------------------------- |
| `sdoc` | `SOBJECT` |          1 | Generated `SDoc__c` | The generated `SDoc__c` object. |

**Technical specifications and best practices**

* **Execution context:** **Synchronous.** Merge and generation occur inside the current transaction.
* **Data formatting:** `userInputs` is Apex-defined as `SDOC__UserInput`.
* **Data formatting:** Map Flow inputs to the expected Apex-defined type structure.
* **Data formatting:** Do not pass raw JSON or raw text in place of the expected structure.
* **Template binding:** `templateNameOrId` and `objectId` are both required.
* **Fault handling:** Route all exceptions through a Flow **Fault** path.
* **Apex SDK equivalent:** Use S-Docs user-input generation APIs in Apex for custom coercion or validation of complex field-level input maps.

***

### Prepare Envelope

Use this action to create the envelope payload for signing.

* **Flow Builder label:** Prepare Envelope
* **API name:** `SDOC__PrepareEnvelopeInvocable`
* **Common output:** `envelopeId`
* **Notes:** Supports in-person signing flows.
* **Implementation guide:** Use [How S-Sign Generates Envelopes](/developer-hub/s-sign-system-architecture/how-s-sign-generates-envelopes.md) to design your signing workflow.

#### Inputs

| Name            | Type      | Required | Max Occurs | Label          | Description                                                  |
| --------------- | --------- | -------: | ---------: | -------------- | ------------------------------------------------------------ |
| `sdocIdsString` | `STRING`  |      Yes |          1 | SDoc IDs       | Comma-separated list of SDoc IDs to include in the envelope. |
| `signInPerson`  | `BOOLEAN` |       No |          1 | Sign in Person | Set true for in-person signing use cases.                    |

#### Outputs

| Name         | Type | Max Occurs | Label       | Description             |
| ------------ | ---- | ---------: | ----------- | ----------------------- |
| `envelopeId` | `ID` |          1 | Envelope ID | ID of created envelope. |

**Technical specifications and best practices**

* **Execution context:** **Synchronous.** Envelope assembly executes in the current transaction.
* **Data formatting:** `sdocIdsString` is a single comma-separated string.
* **Data formatting:** Do not pass a native collection input here.
* **Transaction sequencing:** If **Seal Envelope** follows immediately, add a transaction boundary before sealing.
* **Fault handling:** Wire a Flow **Fault** path.
* **Fault handling:** Log `sdocIdsString` and `signInPerson` when you need replay support.
* **Apex SDK equivalent:** Use S-Docs or S-Sign envelope preparation APIs in Apex when you need signer-rule enrichment or custom validation before seal or send.

***

### Seal Envelope

Use this action to finalize the envelope and return the signing link.

* **Flow Builder label:** Seal Envelope
* **API name:** `SDOC__SealEnvelopeInvocable`
* **Common output:** `signingLink`
* **Notes:** Run this in a separate transaction from **Prepare Envelope**.
* **Implementation guide:** Use [How S-Sign Generates Envelopes](/developer-hub/s-sign-system-architecture/how-s-sign-generates-envelopes.md) to map the full envelope lifecycle.

#### Inputs

| Name         | Type | Required | Max Occurs | Label       | Description             |
| ------------ | ---- | -------: | ---------: | ----------- | ----------------------- |
| `envelopeId` | `ID` |      Yes |          1 | Envelope ID | ID of envelope to seal. |

#### Outputs

| Name          | Type     | Max Occurs | Label        | Description                   |
| ------------- | -------- | ---------: | ------------ | ----------------------------- |
| `signingLink` | `STRING` |          1 | Signing Link | Signing link of the envelope. |

**Technical specifications and best practices**

* **Execution context:** **Synchronous.** Runs in the current Flow transaction.
* **Transaction control requirement:** Do not assume same-transaction chaining is safe after `SDOC__PrepareEnvelopeInvocable`.
* **Data formatting:** Pass `envelopeId` as one valid Salesforce ID.
* **Data formatting:** Do not pass collections or CSV.
* **Error handling:** Capture exceptions through a Flow **Fault** path.
* **Error handling:** Do not rely on a blank or null `signingLink` as your only failure check.
* **Apex SDK equivalent:** Invoke S-Docs or S-Sign envelope APIs directly in Apex when you need explicit retries or idempotency controls.

> **Architectural warning:** If your flow performs DML before sealing, you can hit `uncommitted work pending` callout errors.
>
> **Required Flow pattern for Prepare → Seal:** place a transaction boundary between the two actions by using a **Screen**, **Pause/Wait**, or **Asynchronous Path** before `SDOC__SealEnvelopeInvocable`.

***

### Refresh Document Data

Use this action to refresh an existing S-Doc with current record data.

* **Flow Builder label:** Refresh Document Data
* **API name:** `SDOC__RefreshDocumentDataInvocable`
* **Common output:** `sdocId`
* **Notes:** Keep the Flow aligned with the template base object.
* **Implementation guide:** Use [Refresh Documents with Flow](/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-document-refresh-updated.md) for refresh behavior and document runtime setup.

#### Inputs

| Name                  | Type      | Required | Max Occurs | Label                                     | Description                                                                                                |
| --------------------- | --------- | -------: | ---------: | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `enforceSharingRules` | `BOOLEAN` |       No |          1 | System Mode Generation (Experience Cloud) | Grants unauthenticated or logged-in Experience Cloud users system-level permissions for generation events. |
| `sdocId`              | `ID`      |      Yes |          1 | S-Doc ID                                  | ID of S-Doc record to refresh.                                                                             |

#### Outputs

| Name     | Type     | Max Occurs | Label             | Description           |
| -------- | -------- | ---------: | ----------------- | --------------------- |
| `sdocId` | `STRING` |          1 | Refreshed SDoc ID | ID of refreshed SDoc. |

**Technical specifications and best practices**

* **Execution context:** **Synchronous.** Refresh work executes in the active Flow transaction.
* **Data formatting:** `sdocId` is a single ID input.
* **Data formatting:** For mass refresh scenarios, iterate carefully or use batch-oriented orchestration.
* **Experience Cloud behavior:** `enforceSharingRules` controls system-mode generation behavior for Experience Cloud contexts.
* **Fault handling:** Implement a Flow **Fault** path.
* **Fault handling:** Treat output `sdocId` as success data, not as an error envelope.
* **Apex SDK equivalent:** Use S-Docs refresh APIs from Apex for controlled retries and bulk-aware orchestration patterns.

***

### Generate Documents in Batch

Use this action to queue bulk document generation.

* **Flow Builder label:** Generate Documents in Batch
* **API name:** `SDOC__GenerateBatchInvocable`
* **Common output:** `jobId`
* **Notes:** Supports combined output.
* **Notes:** Supports collated or non-collated output order.
* **Implementation guide:** Use [Batching Documents](/sdocs/automation-and-document-lifecycle/automate-with-flow/generate-documents-in-batch-with-flow.md) for bulk setup patterns and limits.

#### Inputs

| Name                    | Type      | Required | Max Occurs | Label                            | Description                                                                                  |
| ----------------------- | --------- | -------: | ---------: | -------------------------------- | -------------------------------------------------------------------------------------------- |
| `batchSize`             | `INTEGER` |       No |          1 | Batch Size                       | Number of records to process in each batch.                                                  |
| `collateCombined`       | `BOOLEAN` |       No |          1 | Collate Combined Documents       | Sort documents in the combined document to collate by base object.                           |
| `combineAll`            | `BOOLEAN` |       No |          1 | Combine Documents                | Combine all generated documents into one PDF.                                                |
| `combinedFileLocations` | `ID`      |       No |       2000 | Combined Document File Locations | IDs for records or libraries to create `ContentDocumentLink` rows for the combined document. |
| `combinedFileName`      | `STRING`  |       No |          1 | Combined Document File Name      | Name for combined output. Defaults to `Combined Document`.                                   |
| `enforceSharingRules`   | `BOOLEAN` |       No |          1 | Deprecated                       | Deprecated.                                                                                  |
| `recordIds`             | `STRING`  |      Yes |       2000 | Base Record IDs                  | ID(s) of base record(s) used in generation.                                                  |
| `templateIds`           | `STRING`  |      Yes |       2000 | Template IDs                     | ID(s) of template(s) used in generation.                                                     |

#### Outputs

| Name    | Type | Max Occurs | Label        | Description                 |
| ------- | ---- | ---------: | ------------ | --------------------------- |
| `jobId` | `ID` |          1 | Batch Job ID | ID of the queued Batch Job. |

**Technical specifications and best practices**

* **Execution context:** **Asynchronous.** This action enqueues an Apex batch job and returns `jobId` immediately.
* **Bulkification behavior:** Use this action for record collections and high-volume generation.
* **Bulkification behavior:** Prefer it over repeated synchronous generation calls in loops.
* **Data formatting:** Pass `recordIds`, `templateIds`, and `combinedFileLocations` as Flow collections.
* **Data formatting:** Do not collapse multiple IDs into one comma-separated string unless your implementation intentionally parses CSV upstream.
* **Governor strategy:** Tune `batchSize` to balance throughput against row-level automation overhead.
* **Governor strategy:** Reduce batch size if the job hits SOQL, CPU, or heap limits.
* **Deprecated input:** `enforceSharingRules` is marked **Deprecated**.
* **Best practice:** Do not use template-level **Document Actions** with batch generation.
* **Monitoring:** Use `jobId` to track status in **Setup → Apex Jobs** or through `AsyncApexJob`.
* **Error handling:** Use a Flow **Fault** path for queueing failures.
* **Error handling:** Check the queued job for failures that happen after the Flow step completes.
* **Apex SDK equivalent:** [Method: generateDocsInBatch](/developer-hub/document-workflows/software-development-kit/document-generation/method-generatedocsinbatch.md)

> **Architectural warning:** A successful Flow step only confirms that the batch job was queued. It does **not** confirm that document generation finished successfully.

***

### Combine Documents

Use this action to merge existing S-Docs into one combined output.

* **Flow Builder label:** Combine Documents
* **API name:** `SDOC__CombineDocumentsInvocable`
* **Common output:** `sDocIds`
* **Notes:** Use this after documents already exist.
* **Implementation guide:** Use [Combining Documents](/sdocs/automation-and-document-lifecycle/automate-with-flow/combine-generated-documents-with-flow.md) for merge patterns and output planning.

#### Inputs

| Name                    | Type     | Required | Max Occurs | Label                            | Description                                                                                                           |
| ----------------------- | -------- | -------: | ---------: | -------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `combinedFileLocations` | `ID`     |       No |       2000 | Combined Document File Locations | Enter IDs for records or libraries for which to create `ContentDocumentLink` rows to the generated combined document. |
| `combinedFileName`      | `STRING` |       No |          1 | Combined Document File Name      | Enter the file name for the combined document output. Defaults to `Combined Document`.                                |
| `sdocIds`               | `STRING` |      Yes |       2000 | S-Doc Ids                        | IDs of the S-Docs to combine.                                                                                         |

#### Outputs

| Name      | Type     | Max Occurs | Label           | Description                   |
| --------- | -------- | ---------: | --------------- | ----------------------------- |
| `sDocIds` | `STRING` |       2000 | Combined S-Docs | The combined S-Doc ID or IDs. |

**Technical specifications and best practices**

* **Execution context:** **Synchronous.** Runs in the current Flow transaction.
* **Data formatting:** `sdocIds` is typed as `STRING` with `maxOccurs=2000`.
* **Data formatting:** Pass a **Flow Text Collection** of S-Doc IDs rather than one comma-separated string unless you intentionally build and parse CSV.
* **Linking output:** `combinedFileLocations` accepts up to 2000 IDs for file linking.
* **Fault handling:** Configure a Flow **Fault** path.
* **Fault handling:** Do not assume partial success signaling through outputs.
* **Apex SDK equivalent:** Use S-Docs combine or merge APIs from Apex when you need custom ordering, partitioning, or retry behavior.

***

### Create PDF File from S-Doc

Use this action to turn an S-Doc record into a PDF file.

* **Flow Builder label:** Create PDF File from S-Doc
* **API name:** `SDOC__FileCreationInvocable`
* **Common output:** `file`
* **Notes:** This step is rarely used unless after Refreshing Documents.

#### Inputs

| Name     | Type | Required | Max Occurs | Label    | Description                              |
| -------- | ---- | -------: | ---------: | -------- | ---------------------------------------- |
| `sdocId` | `ID` |      Yes |          1 | S-Doc Id | ID of S-Doc to generate a PDF file from. |

#### Outputs

| Name   | Type      | Max Occurs | Label          | Description             |
| ------ | --------- | ---------: | -------------- | ----------------------- |
| `file` | `SOBJECT` |          1 | Generated File | The generated PDF file. |

**Technical specifications and best practices**

* **Execution context:** **Synchronous.** File generation runs in the same transaction as the calling Flow interview.
* **Data formatting:** `sdocId` must be one valid S-Doc record ID.
* **Output handling:** Returned `file` is an `SOBJECT`.
* **Output handling:** Map only the fields you need downstream.
* **Fault handling:** Use a Flow **Fault** path for generation failures.
* **Apex SDK equivalent:** Use S-Docs file generation Apex APIs when you need deterministic post-processing, renaming, extra linking, or retention policies.

***

## Related Flow Screen Components

###

### Live Edit Screen

Use this component to let users edit a generated document.

* **Flow Builder label:** S-Docs Live Edit
* **API Name:** `SDOC__documentEditorModal`
* **Description:** Add the S-Docs Live Editor component to let users edit documents generated through the S-Docs managed package.
* **Implementation guide:** Use [Editing Generated Documents (Live Edit)](/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-live-edit-with-flows-updated.md) for setup steps.

#### Inputs

| Name     | Type     | Required | Max Occurs | Label    | Description                                                      |
| -------- | -------- | -------: | ---------: | -------- | ---------------------------------------------------------------- |
| `sdocId` | `String` |     No\* |          1 | S-Doc Id | S-Doc record ID used by the editor to load the document to edit. |

\* `sdocId` is not explicitly marked required in `targetConfig` metadata.

Treat it as operationally required for predictable runtime behavior.

#### Outputs

| Name              | Type | Max Occurs | Label | Description                                                         |
| ----------------- | ---- | ---------: | ----- | ------------------------------------------------------------------- |
| *(none declared)* |      |            |       | This component does not declare Flow output properties in metadata. |

**Error handling**

* Add a Flow **Fault** path on the screen element that hosts this component.
* Add a Flow **Fault** path on downstream actions that depend on successful edit completion.
* Validate `sdocId` before entering the screen.
* Missing or invalid IDs usually surface as runtime component errors.
* Log record ID, interview ID, and component API name in your fault path.

**Technical specifications and best practices**

* **Component type:** **Flow screen LWC** with `lightning__FlowScreen`.
* **Namespace:** `SDOC`.
* **Execution context:** Runs in the user-interactive Flow screen transaction.
* **Data contract:** Accepts one string input and declares no output contract.
* **Flow design:** Treat completion as UI-driven.
* **Flow design:** Branch flow logic explicitly after the screen.
* **Security context:** Runtime behavior follows Flow context, user access, and package permissions.
* **Design guidance:** Use this component when users must review or edit before email, envelope, or downstream automation steps.

***

### Email Editor Screen

Use this component to let users review email content in a Flow screen.

* **Flow Builder label:** S-Docs Email Screen
* **API Name:** `SDOC__emailEditorModal`
* **Description:** Add the S-Docs Email Screen component to let users email documents generated through the S-Docs managed package.
* **Implementation guide:** Use [Email Editor](/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-email-editor-in-flow-updated.md) for screen setup and attachment flow.

#### Inputs

| Name                     | Type      | Required | Max Occurs | Label                                         | Description                                           |
| ------------------------ | --------- | -------: | ---------: | --------------------------------------------- | ----------------------------------------------------- |
| `modalTitle`             | `String`  |       No |          1 | Modal Title                                   | Title shown in the email editor modal.                |
| `emailTemplate`          | `String`  |       No |          1 | Email Template                                | Template reference used to prepopulate email content. |
| `emailBody`              | `String`  |       No |          1 | Email Body                                    | Initial email body text shown in the editor.          |
| `emailSubject`           | `String`  |       No |          1 | Email Subject                                 | Initial subject value for the outbound message.       |
| `emailTo`                | `String`  |       No |          1 | Email To Address                              | Recipient email address string.                       |
| `emailFrom`              | `String`  |       No |          1 | Email From Org Wide Id                        | Org-wide email ID used as sender context.             |
| `emailCC`                | `String`  |       No |          1 | Email CC Address                              | CC email address string.                              |
| `lockEmailBody`          | `Boolean` |       No |          1 | Lock Email Body                               | Locks body editing when true.                         |
| `lockEmailSubject`       | `Boolean` |       No |          1 | Lock Email Subject                            | Locks subject editing when true.                      |
| `lockEmailTo`            | `Boolean` |       No |          1 | Lock Email To Address                         | Locks To field editing when true.                     |
| `lockEmailFrom`          | `Boolean` |       No |          1 | Lock Email From Address                       | Locks From field editing when true.                   |
| `lockEmailCC`            | `Boolean` |       No |          1 | Lock Email CC Address                         | Locks CC field editing when true.                     |
| `emailAttachmentsString` | `String`  |       No |          1 | Comma Separated Content Version Ids to Attach | Comma-separated `ContentVersion` IDs to attach.       |
| `sDocsAttachmentsString` | `String`  |       No |          1 | Comma Separated S-Doc Ids to Attach           | Comma-separated S-Doc IDs to attach.                  |
| `recordId`               | `String`  |     No\* |          1 | Record Id                                     | Context record ID used for merge and email behavior.  |

\* `recordId` is not explicitly marked required in `targetConfig` metadata.

Treat it as operationally required when merge context depends on a base record.

#### Outputs

| Name              | Type | Max Occurs | Label | Description                                                         |
| ----------------- | ---- | ---------: | ----- | ------------------------------------------------------------------- |
| *(none declared)* |      |            |       | This component does not declare Flow output properties in metadata. |

**Error handling**

* Use Flow **Fault** paths on downstream automation actions.
* This component does not expose structured error outputs.
* Validate email addresses upstream.
* Validate `emailFrom` sender configuration upstream.
* Validate attachment ID strings upstream.
* Ensure comma-separated attachment IDs are correctly formatted.
* Ensure the running user can access attached records and files.

**Technical specifications and best practices**

* **Component type:** **Flow screen LWC** with `lightning__FlowScreen`.
* **Namespace:** `SDOC`.
* **Execution context:** Runs as a user-interactive screen component in Flow runtime.
* **Data contract:** All declared properties are inputs.
* **Data contract:** No metadata-declared outputs are available.
* **Formatting constraints:** `emailAttachmentsString` and `sDocsAttachmentsString` are comma-separated strings.
* **Formatting constraints:** Do not treat these fields as native Flow collections.
* **Design guidance:** Treat this component as a configuration and input-capture screen.
* **Design guidance:** Pair it with explicit post-screen validation and downstream fault handling.

***

### Document Viewer Screen

Use this component to show an S-Doc PDF in a Flow screen.

* **Flow Builder label:** S-Docs Document Viewer
* **API Name:** `SDOC__viewDocument`
* **Developer name:** `viewDocument`
* **Description:** LWC to view an S-Doc PDF via an iframe.

#### Inputs

| Name       | Type     | Required | Max Occurs | Label   | Description                                        |
| ---------- | -------- | -------: | ---------: | ------- | -------------------------------------------------- |
| `recordId` | `String` |      Yes |          1 | SDoc ID | The Salesforce ID of the `SDoc__c` record to view. |

#### Outputs

| Name              | Type | Max Occurs | Label | Description                                                         |
| ----------------- | ---- | ---------: | ----- | ------------------------------------------------------------------- |
| *(none declared)* |      |            |       | This component does not declare Flow output properties in metadata. |

**Error handling**

* Validate `recordId` before the screen loads.
* Missing or invalid IDs can surface as runtime component errors.
* Ensure users can access the target S-Doc and related file records.
* Add Flow **Fault** paths on downstream steps that depend on this screen.

**Technical specifications and best practices**

* **Component type:** **Flow screen LWC** with `lightning__FlowScreen`.
* **Namespace:** `SDOC`.
* **Execution context:** Runs in a user-interactive Flow screen.
* **Flow usage:** Pass the `SDOC__SDoc__c` record ID into `recordId`.
* **Rendering behavior:** The component renders a PDF viewer through an iframe.
  * **Security context:** Users need access to the underlying S-Doc and file records.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.sdocs.com/developer-hub/document-workflows/flow-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
