
1. Collect the files to merge
The component merges the files in Source Files, in the order they are listed. It takes a collection of Resource variables. For each Salesforce File, set the variable's Id to the file's ContentDocument Id, its Name to the name users should see, its Type to file and its Library to salesforce, then add it to the collection. Files from other libraries also need their Drive Id, which the Resources returned by CloudFiles flow actions already carry.
To merge a record's files, use Get Records on ContentDocumentLink for the record, then loop over the files and add each one to the collection with an Assignment. The Merge documents tutorial walks through the same steps.

2. Set the destination
Create a Resource variable for Destination, which is where the merged PDF is saved. To save it to the record the flow runs on, set Library to salesforce and Id to the record Id. To save it to a folder in another library, set Library, Drive Id, and Id to the folder's Id.
Leave Destination blank to let users preview and download the merged PDF without saving it. The merged PDF is then kept for 24 hours.
3. Add the component to a screen
Add a Screen element. Search the components for CloudFiles Merge Documents, drag it onto the screen and set its inputs:
| Input | What it does | Default |
|---|---|---|
| Source Files | The files to merge, in merge order. See step 1. | None |
| Destination | Where the merged PDF is saved. See step 2. | None |
| File Name | Name of the merged PDF. | Merged Document - date and time |
| Open Preview | True: the merged PDF opens in a preview and is saved when the user clicks Save file. False: Merge saves the file straight away and moves to the next screen. | True |
| Show Download | Shows Download in the preview. Users also need the Allow Downloading permission. | True |

The component has its own buttons. Open Configure Footer in the screen's properties and untick Show Footer, so users don't see two sets of buttons.
The component returns Merged Document, which is the saved file, and Error Message. With no Destination, Merged Document is the merged PDF kept for 24 hours. Error Message is blank on success. Otherwise it says why the save failed, or why the user moved on without merging. To show a different screen when nothing was saved, check Merged Document in a Decision after the screen.
4. Add the flow to a page
Save and activate the flow. Then open the record page where users should see it, click the Gear icon and select Edit Page. Drag the Flow component onto the page, select your flow and tick Pass record ID into this variable for its recordId variable. Save the page and activate it.
To let users pick the files in the CloudFiles widget instead, start the flow from a custom list action at flow/Your_Flow_Name?resources={!resources}&recordId={!recordId}. The flow's resources variable then holds the files the user ticked, and you can pass it straight to Source Files. See Setting Up a Custom List Action in the CloudFiles Widget.
Merging files
Users click a file in Merge order to preview it, change the order with the arrows and leave a file out with ×. Merge joins the files into one PDF and converts Word, PowerPoint and image files to PDF along the way.
With Open Preview on, the merged PDF opens in a preview. Users can page through it and download it, or click × to go back to the merge order, change it and merge again. Save file saves the PDF to the destination and moves the flow on. With no Destination, that button says Next or Finish instead.

What each user can do
The screen runs as the person using it, so files in other libraries are read and saved through their own connection to that library. The component merges every file the flow passes in, so pass only files the user should be able to see. Download also needs the Allow Downloading permission.
A user without a Document Generation license sees: You need a Document Generation license to merge files.