Let the platform do the work

Creating Mailing Labels from Sugar Records


Sugar's Doc Merge feature lets users quickly create labels from multiple records without leaving Sugar. Using simple templates that you upload into Sugar, you can easily merge record data with your formatted template and even include data from related records. The example use case in this article walks through creating mailing labels, but you can apply the steps to other use cases like extracting product information for part labels and more. 

Using Doc Merge, you can extract the values of any of the following field types from Sugar to place in your labels: address, checkbox, currency, date, datetime, decimal, dropdown, email, encrypt, float, integer, multiselect, name, phone, radio, textarea, textfield.

Note: Doc Merge is available for Sugar Sell, Serve, and Enterprise 12.0 and higher.

Use Case

You have a seasonal promotion you want to send to a large number of your contacts for whom you do not have email addresses. To target this segment of your contacts, you want to send a mass mailing and need a quick method of generating mailing labels for these contacts. Follow the steps below to create a template for your labels and to merge it with these contact records. 

Steps to Complete

The following sections walk through setting up a document template, uploading the template to Sugar, and merging the template with contact data using Sugar's Doc Merge functionality.

Create the Template

Start by creating a label template outside of Sugar as a DOCX file:

  1. In the Contacts module, determine the number of recipients for your mailing.
  2. In your preferred software application (e.g., Microsoft Word), create a DOCX file and insert a table that contains enough cells to accommodate your segmented number of contacts. Configure your table design to match the size of mailing labels you are using.
    Note: Many label manufacturers will provide label templates for free from their website, or you can use Microsoft Word's label templates found under Mailings > Labels > Options to easily format your document for printing. For more information on the Word option, refer to the Create and Print Labels help article on Microsoft's website.
  3. Save the DOCX file with an easily identifiable name (e.g., Promo_Mailing_Labels.docx).
  4. Leaving the window with your DOCX file open, return to Sugar and click on the Doc Merge link in the footer to open the Doc Merge widget. Click on "Template Assistant" in the widget's header.
  5. On the Fields tab, select the Contacts module.
    kb labelsetup
  6. One by one, click on the following fields to copy their merge codes and paste the codes into one cell in your document template's table: Name, Primary Address Street, Primary Address Street 2, Primary Address City, Primary Address State, Primary Address Postal Code.
    kb labelsetup
    Note: In a real-world application, you will likely want to make the table's borders invisible so that they do not print onto the page of labels. We have left the borders visible for illustrative purposes in this tutorial.
  7. Add a comma and a space character between the merge code for Primary Address City and Primary Address State so the label is formatted correctly.
  8. Add a {#record} tag to the beginning of the label, which is going to represent one record from Sugar.
  9. Add a {/record} tag to the end of the label to tell Sugar it has completed one merged record.
  10. Copy the contents of the first label into the remaining cells in the table.
  11. Add a {#records} tag to the beginning of the first label to identify the beginning of the set of records.
  12. Add a {/records} tag to the end of the last label to identify the end of the set of records.
    kb docmergelabels

Note: Conditionals (e.g., {if}, {else}) are not supported when making mailing labels.

Upload the Template

After creating the DOCX template, upload it to Sugar's Document Templates module, as described in the Doc Merge documentation, and be sure to enable the Label Merging option for the template record.
kb uploaddoctemplate

Merge Records with the Template

The final step is to merge the segmented records with the document template you created, as described below:

  1. Navigate to the Contacts module list view.
  2. Select the desired records, and then expand the Mass Actions menu.
  3. Select "Merge to Doc".
    kb mergetodoc
  4. In the search and select drawer that opens, select the document template you uploaded. The merge process begins immediately.
    kb mergedocselect
  5. Expand the Doc Merge widget and then click the file icon to access the merged document.
    kb docmerge download
  6. Open the downloaded file and confirm that the field values from your selected records have successfully merged with the template to produce the label document. 

kb docmerge download