Doc Merge in SugarCRM pulls data from your Sugar records and merges it into document templates without you having to leave Sugar. This functionality enables you to quickly export contracts, quotes, NDA agreements, form letters, labels, and much more.

You create and design your own custom templates, and using Doc Merge, you can create individual or multiple documents within minutes. This powerful feature will save you time producing common documents within Sugar while linking these documents to Sugar records for future reference.

Creating a Merged Document Template

Doc Merge templates are Word, Excel and Powerpoint (DOCX, XLSX, PPTX) documents that include Sugar field references. The Doc Merge Template Assistant tool helps you find the fields and data you want to include in your merged documents and is the easiest method for creating templates. 

Launch the Template Assistant by clicking the Doc Merge widget in Sugar's footer. The Template Assistant will open in a new window.

click doc merge section

The Template Assistant along with Sugar Logic can help you create a customized professional document.  With this functionality, you can: 

-Insert lists or tables of data from related Sugar records.

-Place a custom-formatted date stamp in your template. 

-Apply calculations, logic checks, and formatting to your data. 

use this field to directly select module

Let’s delve into each section of the Template Assistant further.


Use the Fields tab to copy the codes for SugarCRM module fields to your system clipboard and paste them into a document template.

select field codes and steps

Paste each copied field into your document template file to create your customized document.

document field created

Dynamic Elements

Use the Dynamic Elements selection to add a date stamp, table, or list of related module data to document templates. 

Date Stamp:

select date


select fields and create list


select the fields for your document

Sugar Logic

Use the Sugar Logic selection to add calculations to your document. Example functions include counting the related records (count), returning the sum of several values (rollupConditionalSum) or the difference between two values (subtract), and even converting a non-string value to a string (toString).

select functions

Now, What do you do with all this data?

Using the Document Templates Module

The Document Templates module was added to SugarCRM to support the Doc Merge feature. The Document Templates module is where you can upload and manage your customized document templates. 

Note: The Document Templates module is hidden by default. If you do not see the Document Templates module, unhide the module via Admin > Display Modules and Subpanels.

Upload your Template to Sugar

upload your template to sugar
  1. Add a name for your template
  2. Upload the template file from your computer
  3. Select the module this template relates to
  4. Select Label Merging if you want to creating mailing labels
  5. This will be assigned to the logged in user by default but can be updated
  6. Assign which teams should have access to the file

Creating your Document

After creating the template, you can now create a document based on a Sugar record.  To do this, you would open a record from the Sugar module and run the Doc Merge file from the record.

create document

A pop up will appear at the bottom of your screen indicating the status of the document.  When the file creation is complete you can view or email the document or send a notification to another team member.

document status

The document will be saved to the record in the Documents sub-panel of the record.

your document is saved
Posted in:

Looking for SugarCRM help?

We do training, customization, integration, and much more. Contact us today.