Merge Document Action
The Merge Document action allows you to merge multiple Microsoft Word or PDF files into one file, as well as convert Word files to PDF. This action takes the existing documents in an attached file field and combines them into one output file using your desired configuration settings. Other file types in the file field, such as image files or .xlsx files, are ignored when this action runs.
Merge Document actions work in a variety of situations where you want to create a single document from multiple attached files. For example, you might want to create a single file that includes a contract and all of its amendments. In this case, you could merge the original contract file in a local field with the files in a field from a related table that contains the contract's amendments. In another scenario, maybe you have a project with several tasks, and each task contains supporting documents. You could merge all of the supporting documents from the tasks into a single file in the project.
If you plan to convert from Word to PDF when you merge documents, you must have the Microsoft Word API enabled in your knowledgebase. For more information, see Microsoft Word Services Integration.
Create a Merge Document Action
You can find the Actions wizard with several different navigation paths, but the easiest is to select Setup [Table Name] on the left pane for the table where you wish to create your action.
- Click the Actions tab in the Table wizard.
- Click Create Merge Document Action. The Merge Document action wizard opens.
On the General tab, give the action a name and description.
Once your action is saved, the system automatically adds an M: before your given title to distinguish it as a Merge Document action.
Click the Data Source Tab.
Data Source Tab
On the Data Source tab, you choose the fields holding the files that will be merged. You also select where the merged document is stored.
- Select the source field that contains the files. The source field can be a local file field, a linked file field from another table, or a file field in a related table.\
- If the source field is a field from a related table, you can choose a saved search to filter the records that the action operates on.
For any of the options, you can also choose up to three additional fields that hold other files to be merged. If you choose additional fields, you must also select the order in which the original source field is merged.
The file you identify as First is also used for the headers and footers in the final output. If you want to merge the headers and footers across documents instead, create a Choice global variable named user_hdr_ftr_first_doc_4_merge and set it to No.
- Choose whether to open the document in the browser window or save it in another file field. If you save the document, you can append the file to the field or overwrite existing files.
- Create a default name for the merged file, using at least one variable so that the name is unique. Do not include the file extension, and use a space to separate any field variables from regular text.
- Click the Options tab.
Use the Options tab to configure various settings for the merged document.
- Select whether to output the merged file as PDF or Word (.docx) format. If you choose Word, the Merge or Convert First section is hidden, which allows you to manage Word to PDF conversion.
- Select the page size for the final output. If the source documents don't always use this page size, you can select the option to automatically scale the source documents if necessary.
- Decide how to manage page breaks in places where two documents are merged. The "Start each document on a new page" option inserts a page break when a new document is merged. The "Concatenate documents without inserting any page breaks" option merges documents seamlessly without any page breaks. The latter option only works when you merge Word files, either into another Word document or a PDF.
If the output format is PDF, choose whether to include or ignore Word files during the merge. If Word files are included, choose whether consecutive Word files are merged and then converted to PDF, or whether Word files are converted to PDF and then merged. If you convert Word files to PDF and then merge them, they retain their original styles. If you merge consecutive Word files before converting to PDF, the pages of the merged document are numbered consecutively based on the first page number, and the first file's style definitions are used on all subsequent pages.
If you merge a mixture of Word and PDF documents, consecutive Word documents may be merged with one style and then interrupted by PDF files, and any Word files that come after the PDF files take the style of the first Word file immediately following the last PDF file.
If the output format is PDF, choose whether Word to PDF conversion should use MS Word services on the current server or a remote server. Word to PDF conversion requires the Microsoft Word API to work. For more information on how to configure this functionality in your knowledgebase, see Microsoft Word Services Integration.
- Click Finish.
In an Incident record, imagine you want to create a single PDF from a group of several Word documents that provide supporting material. In the final merged document, you want consecutive page numbers and a consistent style.
Remember, before you get started, you need to enable the Microsoft Word API in your knowledgebase. See Microsoft Word Services Integration for more information.
Create the Fields
Before creating the Merge Document action, create the additional fields that the action will use.
- In the Incidents table, create a File with Versioning field that will contain the newly merged document.
- Name the field Final Supporting Document or similar, and configure the other settings as desired.
- Create an Action Button field to contain the Merge Document action.
- Name the button Merge Supporting Material or similar.
- Select the Execute Actions checkbox and click Add Action. The Actions wizard opens.
Create the Merge Document Action
Use the Actions wizard to create a new Merge Document action.
- Click Create Merge Document Action.
- On the General tab, add a name and description for the action.
- Configure the settings on the Data Source tab:
- For the source file location, select Local File Field and choose whichever field holds the Word documents.
- Store the merged document in the Final Supporting Document field that you created.
- Overwrite any existing files in the field.
- For the default file name, use
- Configure the settings on the Options tab:
- Select PDF for the output format.
- For page breaks, choose to concatenate the documents.
- Include MS Word files during the merge, and merge the documents before they're converted to PDF.
- Use the MS Word installed on the current server.
- Click Finish.
Finish the Setup
- Configure the rest of the action button as desired and save it.
- Add the fields you created to the layout.
- For an Incident record with Word files in the relevant field, click Merge Supporting Material. The files are merged into a single PDF with page numbers and a unified style, and it's placed in the Final Supporting Document field using the default file name.