How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows?
Nullam vel lectus vel velit pellentesque dignissim nec id magna. Cras molestie ornare quam at semper. Proin a ipsum ex. Curabitur eu venenatis
March 01, 2023
2429 Views
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows?](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-01.35.48.png)
Requirement:
Alex need to print 1000 pdf files stored in salesforce across multiple objects or records. As per salesforce standard, there is no out-of-box functionality to merge without downloading the files. User needs to download the files and use any external tool to merge them or print them one by one manually.
These type of work requests would take much more effort and time for an end user. In order to overcome this situation, here we are introducing the “AYAN PDF” – an api kit for all your needs.
Using AYAN PDF merge apis, user can easily merge any number of files in salesforce using multiple ways.
User can merge Files using AYAN PDF Apis in multiple ways:
- Flow
- Apex Classes (using synchronous or asynchronous methods like batch, future)
- Lighting Component
- Visualforce Pages / JavaScript
Benefits of using AYAN PDF Apis to merge files:
- User can merge any number of files in single click
- User can merge any type of files (like Salesforce Files, Attachment, Documents)
- User can call these apis in multiple ways as highlighted in above table
- Simple and easy to integrate
How can we merge files using AYAN PDF Apis?
User can merge multiple files into single pdf in two ways:
- Calling AYAN PDF Apis in Apex/Aura – Being a Salesforce Developer, user can use the below two apis to merge files in few clicks.
- Calling Predefined Flow – Our Appexchange solution “File ZIPO”, uses the AYAN PDF Apis to merge multiple files into Single File. Once installed, user can call a predefined “Merge Flow” which is a part of this managed package, in which user needs to pass few parameters and files will be merged and sent to the email address defined by the user.
Let’s learn how to do it step by step:
Few Simple Steps to Merge Salesforce Files using pre-defined FLOW in File ZIPO:
Step 1. Install the latest version of Salesforce Appexchange application called “File ZIPO” using below link:
https://www.filezipo.io/release-notes/
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows? 1 Screenshot 2023 02 09 at 00.46.49](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-00.46.49.png)
Step 2. Once installed, user will find two flows in their list of flows (displayed in the below table).
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows? 2 Screenshot 2023 02 09 at 01.09.08](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-01.09.08-300x52.png)
- Merge Files Using AYANPDF API – this is the main flow which needs to be called to initiate the process for merging the files. The sample flow also calls this main flow.
- Merge Files Reference Flow using APIs – this is the reference / testing flow which guides user with the ways to merge files in multiple ways. In this sample flow, user can call the below actions and try to merge files using apis.
Actions include:
- Allow user to find & select attachments and send for merge
- Allow user to find & select files and send for merge
- Allow user to find & select documents and send for merge
- Allow user to find attachments and send for merge (without selection)
- Allow user to find files and send for merge (without selection)
- Allow user to find documents and send for merge (without selection)
- Allow user to merge AWS S3 public files into single pdf file
Step 3. User can create its own flow here or can refer next few steps in which we will use the “sample flow” to explain how user can call the “main flow” and pass its parameters.
Just click on sample flow name and click this “run” button:
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows? 3 Screenshot 2023 02 09 at 01.19.33](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-01.19.33.png)
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows? 4 Screenshot 2023 02 09 at 01.21.49](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-01.21.49.png)
- Receipient Name – defines the name of the person who has submitted the request
- Merged File Name – defines the name of the merged file name which should be sent to the user
- Receipient Email – defines the email of the recipient user
- Receipient cc address – this is optional field
- Choose Action type – defines the type of action with which user needs to test the apis.
This is reference or sample flow only. User can clone or edit this flow and can make the changes to it to test different scenarios.
Step 5: Once the “Next” button is clicked, depending upon the action selected, it will display the next screen. Let’s take an example that user has selected the action as “Allow user to select files and merge”
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows? 5 Screenshot 2023 02 09 at 02.13.22](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-02.13.22.png)
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows? 6 Screenshot 2023 02 09 at 02.14.41](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-02.14.41.png)
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows? 7 Screenshot 2023 02 09 at 02.19.57 1](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-02.19.57-1.png)
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows? 8 Screenshot 2023 02 09 at 02.27.16](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-02.27.16.png)
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows? 9 Screenshot 2023 02 09 at 02.39.37 1](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-02.39.37-1-300x153.png)
Note:
The Steps 4, 5, 6 has gathered the different type of information as highlighted in below table from the UI Screens. These parameters needs to be passed to main flow “MergeFiles Using AYANPDF API” to initiate the merge process.
- Recipient Name – Defines the name of the person who has submitted the request
- Merged File Name – Defines the name of the merged file name which should be sent to the user
- Recipient Email – Defines the email of the recipient user
- Receipient cc address – Defines if need to add anyone in CC (this is optional field)
- selectedRecordType – Defines the type of record we are trying to merge. It can contains either one of these three values: Attachment, File or Document
- selectedRecordIds – Defines the list of record Ids of any of three objects (Attachment, Content Version, Document). Please don’t combine the Ids of multiple entity in single list.
- selectedAttachment_List – Defines the list of Attachments records which needs to be merged
- selectedDocument_List – Defines the list of Document records which needs to be merged
- selectedFile_ContentVersion_List – Defines the list of Content Version records which needs to be merged
![How to Merge Multiple Salesforce files into Single PDF using Salesforce Flows? 10 Screenshot 2023 02 09 at 01.35.48](https://ayaninsights.com/wp-content/uploads/2023/02/Screenshot-2023-02-09-at-01.35.48.png)
- Share this article
Contributor of the month
![contributor](https://ayaninsights.com/wp-content/uploads/2024/09/image_2024_09_19T05_58_02_354Z.png)
Mithun Naik
Software Engineer | Salesforce | 3X Certified Developer | Salesforce Blog Writer
Categories
Most Viewed Posts
Boost Your Brand's Visibility
Want to promote your products/services in front of more customers?
Explore More Blogs
Default title
This will close in 0 seconds