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

Combine Generated Documents with Flow

Combine previously generated S-Docs in Flow by passing a text collection of SDoc record IDs into the Combine Documents action.

Use this guide when you want a Flow to combine existing generated S-Docs into one file.

Use this pattern when the documents already exist and you want one final file for delivery, review, or storage.

This action combines documents that were already generated in S-Docs.

Use supported source formats such as PDF and PDF-Upload.

Start here if you are newer to Flow

New to Flow? Start with Getting Started: Automate Document Generation.

Prerequisites

  • A Flow that can run S-Docs actions

  • Generated SDoc records to combine

  • Access to the target SDoc records

  • Access to any record or library where the combined file should be linked

  • One Text collection variable for SDoc record IDs

  • An optional second Text collection variable for link record IDs

Flow outline for combining generated S-Docs

Step-by-step tutorial

Step 1: Create the SDoc ID text collection

In Flow Builder, click ManagerNew Resource.

Create a Variable resource.

Set Data Type to Text.

Enable Allow multiple values (collection).

Use this collection to store the generated SDoc record IDs.

Step 2: Get the SDoc records in the order you want

Add a Get Records element for SDoc records.

Filter for the documents you want to combine.

Choose Get All Records.

Sort the records in the exact order you want in the final file.

The combined output follows the order of the IDs you pass into the action.

Step 3: Loop through the records and add each ID to the collection

Add a Loop element for the returned SDoc records.

Inside the loop, add an Assignment element.

Append each current record Id to the Text collection variable.

Use the loop only to build the collection.

Do not run the combine action inside the loop.

Step 4: Add the Combine Documents action

Add an Action element after the loop.

Choose the S-Docs combine documents action.

Enter a Label and API Name.

Use the action that accepts a text collection of generated SDoc record IDs.

Combine Documents action selected in Flow Builder

Step 5: Map the required and optional values

Map S-Doc IDs to the text collection of generated SDoc record IDs.

Map Link Record IDs only when you want to link the combined file to records or libraries.

Map Combined File Name only when you want to override the default file name.

If Combined File Name is blank, S-Docs uses Combined Document.

Step 6: Save, activate, and test

Save the Flow.

Activate it.

Then run a test and confirm the Flow:

  • combines the expected documents

  • keeps the expected document order

  • links the combined file where you expect

  • creates the file in Salesforce Files when no link target is passed

Troubleshooting and common errors

No combined file is created
  • Symptom: The Flow finishes, but no combined file is created.

  • Cause: The S-Doc IDs collection is blank, or it contains IDs that are not valid generated SDoc records.

  • Fix: Check the Get Records, Loop, and Assignment elements. Confirm each Id is added to the correct Text collection before the action runs.

The documents are combined in the wrong order
  • Symptom: The combined file includes the right documents, but the order is wrong.

  • Cause: The Get Records sort order does not match the intended output order.

  • Fix: Update the Get Records sort order before the loop. Then test again.

You cannot find the combined file
  • Symptom: The action succeeds, but you do not see the output where you expected.

  • Cause: No link target was passed into the action.

  • Fix: Check Salesforce Files first. That is the default location when no record or library is provided.

The Flow faults when the action runs
  • Symptom: The Flow errors when it reaches the combine action.

  • Cause: The running user cannot access one or more SDoc records, or cannot link the file to the target record or library.

  • Fix: Confirm object access, record access, and file access for the running user. If needed, add a Fault path so the Flow surfaces the exact error during testing.

Advanced configurations and reference

Required action input

  • S-Doc IDs — Required. Pass a Text collection of generated SDoc record IDs.

Optional action inputs

  • Link Record IDs — Optional. Pass a Text collection of record IDs or library IDs where the combined file should be linked.

  • Combined File Name — Optional. Pass a Text value for the output file name.

Output behavior

  • The action creates one combined file from the SDoc records you pass in.

  • The action follows the order of the IDs in the collection.

  • If you pass link targets, S-Docs links the file to those records or libraries.

  • If you do not pass link targets, the combined file is stored in Salesforce Files by default.

Last updated

Was this helpful?