SharePoint Flex’s Merge function provides the ability to merge Flex data from any List into a Word document. The Merge Field functionality allows for any field Column to be used.
The merged document will be automatically saved to the List item it was created for (ie. Opportunity, Contact, Contract, etc.).
Template documents (.docx format) are saved to the Templates folder in the Document Library.
Note: The Document Merge function merges one document at a time. It is NOT a mass merge system. To mass merge perform a search using the Advanced Search feature, then export the list to Excel and use Word and Excel’s Merge functionality.
Create a Merge Template
To create a new Document Template for the Merge function, follow the steps below.
The document should be Word version 2007 or above and must be a .docx extension.
- Create a new document in Microsoft Word.
- Click inside the document.
- From within Word click the “Insert” tab; then, select the “Quick Parts” icon and from the drop down list select “Field” as shown below. This will open the Field Properties functions of Word.
- Under the Field names list, scroll down the list and select “MergeField”, then enter the Field Name exactly as it appears in the Flex list into the Field name box as shown.
- When you click OK, it will insert the field name with the appropriate coding into the location where your cursor was placed.
- Continue adding MergeFields in the same manner, inserting into the position in the document as required.
- Be sure to save the Word file as a .docx type.
- You can either save from Word if access is provided to the Flex Document Library or you can upload the template to the Templates folder using either the Quick Launch link or Site Contents.
- Locate the “Templates” folder and select it.
- On the Toolbar Ribbon, select “File” and upload your Document.
Macro Fields
In addition to using the Field Names as MergeFields in your documents, there are two useful macros for merging addresses from SharePoint Flex. They are: “Account.FullAddress” and “Contact.FullAddress”.
These macro fields will pull the full address fields based on the Advanced Settings:
- Account.FullAddress is looking to the setting “AccountsAddressColumnMappings” for its address format.
- Contact.FullAddress is looking to the setting “ContactsAddressColumnMappings” for its address format.
- Lead.FullAddress is looking to the setting “LeadsAddressColumnMappings” (also can be “LeadsAddressFieldMappings”)
To use either of these macros in your Document Templates, simply insert the macro into the MergeField exactly as shown here:
Using Templates
Once the Templates are saved to the Templates folder of the Flex Document Library, the users can start to use the function which is available from the Action Bar for each item.
Note: Please ensure your Templates are set to Read Only to avoid users editing them.
The Action Bar button name can be labeled to your preference (Create Quote, Merge Quote, Send Letter, etc.), but the list of Documents presented for Merge are contained in and drawn from the Templates folder. (See instructions for Action Bar Settings below.)
- A window displaying the documents from the Templates folder appears. Select the desired document to merge.
- A new window will open to confirm your action and to request a new name for the document. If a document with the same name already appears in your local directory, the file will be saved with a number appended to it. [ie: my doc(1).docx]
- If the Content-Type feature is enabled for your Flex Site, the option for selecting a type will appear automatically.
- Rename your file, if necessary, then select “Merge and Save”.
- Click the ‘here’ link to open, then OK past the suspicious file window.
- Depending on the size of the document, the merge may take a moment. Microsoft Word will open the new document.
Action Bar Setting
Every embedded Flex list has an Action Bar Items Setting which will correspond to the Action Bar on the item Display page.
Setting Name: [ListName]ActionBarItems
Setting Value: [Menu Text]|[Image FileName]|mergedocument
Change the text of the button by changing the text shown above, ie. “Merge Doc”.
Note: The Merge function can be added to any Action Bar, even for a custom list.