Suppressing Address 2 Field in Microsoft Dynamics CRM 2011 Mail Merge
Posted by Lynn Harris on Wed, Aug 03, 2011
Frequently in Microsoft Dynamic CRM mail merges that involve addresses, there is a second line for the street address. This second line is normally used for a suite or apartment number. But what happens to our merge when no data exists for that merge field? We need to eliminate the blank line from our mail merge if the field is empty.
Let's walk through the steps of creating a Microsoft Dynamics CRM 2011 (Outlook client) mail merge template and we will suppress the Address 2 field if the data is empty. We are using Microsoft Office Word 2010 in this example.
First let's start with creating a basic mail merge template:
-
In the Microsoft Dynamics CRM folder list, expand the Settings folder, and click Templates. Select the option Mail Merge Templates.
-
In the grid toolbar, click New to create the new mail merge template.

-
The Mail Merge Template:New form opens. Enter a "friendly" name and description if needed.
-
In this example we would like this mail merge template to be available from the contact record. From the drop-down list in the Associated Entity field, select Contact.

-
Before we can continue, we are required to Save.

-
Once you select Save, you will see the warning that no document has been attached and this record can not be used for mail merge unless it has a Microsoft Word document saved as an XML file. Also notice we now have the option on the toolbar to Create Template in Word. But let's add some additional data fields before we go into Microsoft Word.

-
In the bottom left hand corner of this form, select the Data Fields button.

-
You can have a maximum of 62 data fields for your mail merge. The Record Type by default is displaying the fields available from the Contact entity. In this example we have selected the contact's first name and last name.

-
Once all the fields have been selected for your mail merge, click OK and from the toolbar click the Create Template in Word.
-
Microsoft Word launches.
-
In the Mail Merge Recipients dialog box, you will need to select the OK to confirm the data source for your mail merge.

-
A blank document is now available for you to create your letter.
-
Under the Mailings tab, click the Address Block field.

-
Using the Address Block field we can specify address elements for this template and Correct Problems with Match Fields.


-
Continue inserting fields using the Insert Merge Field.

-
All the inserted data fields in your document will be highlighted as shown below:

-
Once you have completed your letter, from the File menu, click Save. You must save your letter as a XML document.

-
Close Microsoft Word. You will be prompted to stop the current mail merge. Select OK.

-
In Microsoft Dynamics CRM, browse for the newly saved document and attach it to the record.

-
Click Save and Close. The template is now ready for use.
Now let's merge the template for a contact record. In this example, the contact's address only has data in the Street 1 field, the 2nd line is empty.
-
In Microsoft Dynamics CRM browse to a contact record.

-
Click on the Mail Merge button.

-
The Microsoft Dynamics CRM Mail Merge for Microsoft Office Word dialog box opens. In the section "Start with a:" select the option Personal mail merge template and browse to select the template name. By default the templates are individually owned unless you publish it to the organization.

-
Select the OK.
-
Microsoft Word launches and the Mail Merge Recipients dialog box opens displaying the list of recipients that will be used in the mail merge. Click the OK button.
-
To preview the merge, click Finish & Merge.

-
You have a couple of options once you merge: Edit Individual Documents or Print Documents. Notice below the 2nd Address line has been suppressed.

-
Close Microsoft Word after completing your merge and printing the letter.
We know training takes time...valuable time from your busy day. We are excited to offer at NO CHARGE micro-training sessions on Microsoft Dynamics CRM 2011. These sessions are never longer than 30 minutes and focus on one or two practical tips. For more information on these sessions, click here.