PDF Merge Feature
If you need to merge additional existing PDFs with your generated document you may do so using this optional feature. If interested in enabling this feature with your app subscription, please contact support to enable this feature in your org.
Once support has enabled the custom setting to merge additional PDFs in your org, the following fields will be available to add to your Document Action page layout:
Merge Additional Documents: This is a checkbox field that you will need to check to merge additional PDFs within related document action.
Note that if you check this box and support has not enabled this custom setting in your Salesforce org, you will see an error message when trying to save your document action.
Template Position: The purpose of this picklist field is to decide which position you would like the generated document from google doc template in document action to merge in comparison to rest of PDF merge documents.
If you would like the generated document from template to show first in PDF merge, you would select template position “1” in this field.
If for example you wanted to merge some cover page or marketing graphic material to show first in PDF merge, you could have the template position field as “2” instead so cover page PDF or marketing graphic would show first in merged document and then generated document second.
Note that if you do not populate a template position in this field, app will default the generated document from template to be “1” so it is first in the merged PDF with other attachment(s).
Delete Extra Generated Attachment: If using the document action feature to “attach file to record”, you will see two separate attachments get created: One attachment will have just the generated document merged from template and the second attachment will include the other additional PDF merge attachments. To automatically delete the initial template-only generated document, select the “Delete Extra Generated Attachment” checkbox. The only document that will be attached is the PDF that contains the generated document plus the additional documents.
Document Fields 2 through 10: These fields will store the existing PDF File ID that you would like to merge additional existing PDFs in document action. You have the option to merge 1 to 10 additional existing PDFs into document and you would only populate the Document field(s) with File IDs that are needed to merge in document action.
To pull existing PDF File ID: Open an existing PDF File record in Salesforce > Click on “View File Details” (see Figure 1 below for visual example) > then copy the Id from the URL address bar.
For example, if the URL of existing PDF File is showing as “https://jennatest.lightning.force.com/lightning/r/ContentDocument/0691R00000JyQ38QAF/view” then the File ID you would copy and paste into Document field in document action would be 0691R00000JyQ38QAF (see Figure 2 below for visual example).Figure 1: Showing example Image to find “View File Details” from drop down arrow when viewing File.
Figure 2: Showing example image of the URL of PDF File to pull File ID “0691R00000JyQ38QAF:”
Once you have configured document action with all needed fields populated and have all File IDs, you will save and then paste updated document action code into a custom button.
After you generate the document using this feature, you will see all PDFs documents merged into one final PDF and in order that you selected for template position in document action.