Mail Merge and more…

Hope you are having fun with enhanced mail merge functionality in Titan and others in general. In this article I would like to touch on a number of topics about mail merge support in Microsoft Dynamics CRM 4.0.

a) Many faces of mail merge.

b) Mail merge experience in different clients and modes.

c) Configuring web mail merge support in CRM.

d) Configuring mail merge support for entities.

e) Emailing to custom and non primary email address via mail merge

a) Many faces of mail merge.

Mail merge functionality can be assessed from different places; you might be amazed on how many code paths lead into mail merge.


- Mail Merge from grid.

Mail merge in this case is called by clicking the mail merge icon on the grid. Along with other options, it gives users an option to run mail merge on selected records, records on the current page or on the current view. Mail merge from grid is available for all mail merge enabled entities. By default account, contacts, leads, opportunities and all custom entities are mail merge enabled.


- Mail Merge from Advance find and sub grids.

Mail merge functionality can be invoked for mail merge enabled entities from the advance find dialog and the related entity sub grids shown on the entity detail page.


- Mail Merge from entity detail page.

Mail merge functionality can be invoked from the actions menu on the entity detail page of the mail merge enabled system entities. Like account, contact and lead.


- Mail Merge for marketing list.

Mail merge functionality here can be invoked from the marketing list detail page and will run on the members associated with that list.


- Mail Merge for Campaign activity.

Mail merge functionality here can is invoked by clicking the distribute button on the campaign activity detail page, when the channel type is set to distribute via mail merge. The records participating in the mail merge are the members associated with the campaign activity. Campaign activity contains marketing lists and the marketing lists in turn lists the members (account, contact or lead). For distribution of campaign activity via mail merge the member type of all associated marketing list needs to be same.

Note: this feature is available only from CRM online outlook client.


- Print quote for customer.

This is a special feature where users can generate summary document containing all quote product associated with the quote. The functionality is invoked from the quote detail page.


- Mail Merge vs. quick campaign.

In titan, users can create quick campaign when running mail merge and tracking output in CRM. The usefulness of tracking a mail merge via quick campaign is that it gives them a single location of viewing all the records that were generated. It lists the records that participated in the mail merge and records that were excluded from the mail merge due to privacy conditions or failure. Also note that users can access mail merge functionally from within create quick campaign wizard and have the same results.

Note: this feature is available only from CRM online outlook client.

From mail merge tracking dialog.


From quick campaign wizard.


- Mail Merge Template detail form.

A variation of the mail merge functionality is also exposed from the mail merge template detail form. The goal here is to assist user is creating and editing mail merge templates. The functionality is invoked by clicking the “Create template in word“ or “Edit template in word” button.



b) Mail merge experience in different clients and modes.

The mail merge behavior varies depending on the client the user is using to invoke mail merge. When in web client, the mail merge is enabled by using signed macros and associated templates. For outlook client the CRM addin loaded inside outlook, handles the mail merge invocation. Web mail merge makes the functionality more available to the user as it requires no client bit installations, where as outlook client gives enhanced functionality like the auto tracking of generated items and upload template to CRM.

Also there are differences in behavior when using mail merge in CRM outlook online mode verses offline mode. Some features like Campaign activity distribution and creating quick campaigns from mail merge are only available when in online mode.

c) Configuring web mail merge support in CRM.

- Web mail merge is a powerful feature for you when you are trying to quickly print out some letters for a set of customers or email them. This does not require your to be logged inside outlook or running a smart client.

- Via the web the user invokes web mail merge, the user is provided with a document with the template they have chosen and data source. With a click of button they are inside mail merge and running it.

- The web mail merge uses Word VBA support of macros to enable the seamless integration. The macro is Microsoft signed content and it is delivered inside the document via the CRM Template located on the server.

- Some times businesses have a no macro use policy and would like to disable the web mail merge functionality. For such cases, there is a new miscellaneous privilege “Web mail merge” that can be used to disable web mail merge for users.


d) Configuring mail merge support for entities.

- Mail merge support for an entity is driven by the entity metadata field “IsMailMergeEnabled”.

- For custom entities mail merge is enabled by default. It’s less known that this setting is actually configurable. There is no UI to enable or disabled this setting from the customizations area. But via the SDK or customization import, users with system administrator role or system customize role can reset it.

- For system entities its only enabled for Account, contact, lead and opportunity. This field is not configurable via the SDK or customization import.

- Steps to flip the mail merge support for a custom entity via SDK

using MetadataSDK = /* your metadata web reference.*/;

public static void Main(string[] args)




// Create Metadata service.

MetadataSDK.MetadataService svc = new MetadataSDK.MetadataService();

svc.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

svc.Timeout = -1;

svc.CrmAuthenticationTokenValue = new MetadataSDK.CrmAuthenticationToken();

svc.CrmAuthenticationTokenValue.OrganizationName = "OrgName"; // Your organization name.

// Create retrieve entity request.

MetadataSDK.RetrieveEntityRequest request = new MetadataSDK.RetrieveEntityRequest();

request.LogicalName = "new_mycustomentity"; // Custom entity name.

request.EntityItems = MetadataSDK.EntityItems.EntityOnly;

MetadataSDK.RetrieveEntityResponse response = (MetadataSDK.RetrieveEntityResponse)svc.Execute(request);

// Log.

Console.WriteLine("IsMailMergeEnabled = " + response.EntityMetadata.IsMailMergeEnabled.Value);

// Flip the mail merge support for that entity.

MetadataSDK.EntityMetadata entity = new MetadataSDK.EntityMetadata();

entity.MetadataId = response.EntityMetadata.MetadataId;

entity.IsMailMergeEnabled = new MetadataSDK.CrmBoolean();

entity.IsMailMergeEnabled.Value = !response.EntityMetadata.IsMailMergeEnabled.Value;

// Execute request.

MetadataSDK.UpdateEntityRequest request1 = new MetadataSDK.UpdateEntityRequest();

request1.Entity = entity;


// Confirm results.

MetadataSDK.RetrieveEntityResponse response1 = (MetadataSDK.RetrieveEntityResponse)svc.Execute(request);

// Log.

Console.WriteLine("IsMailMergeEnabled = " + response1.EntityMetadata.IsMailMergeEnabled.Value);


catch (Exception e)





- If you need more information on using the SDK you can download the CRM 4.0 SDK from

- If you are new to SDK and uncomfortable using it, you can use an alternative method for resetting this field via import/export customization.

  • Export out the customizations for the custom entity for which you intend to switch the mail merge support off.
  • The customization are exported to a file like
  • Open the zip file and extract the customization.xml present inside it.
  • Update the “IsMailMergeEnabled” node value from 1 to 0
  • i.e. <IsMailMergeEnabled>0</IsMailMergeEnabled>
  • Next, import the updated customization.xml file back into CRM via import customizations.
  • Publish the custom entity after import.
  • The mail merge support for that entity will be switched off now. I.e. no mail merge icon will show up on that custom entity grid.

e) Emailing to custom and non primary email address via mail merge.

Consider the following scenarios:

1) You have a set of entities say account where there are two email addresses present on it. You wish to send emails to the secondary field (emailaddress2) and not the primary email address (emailaddress1). Currently CRM does not allow you to do that.

2) You have created a custom field on opportunity to store opportunity’s email address. Currently CRM does not allow you to send email to opportunity.

3) You have created a custom entity with a custom field name new_email. CRM does not allow you to create email and send them to these custom email fields.

In all the above scenarios, mail merge can help. You can run mail merge on the selected entities and select the merge type as e-mail. Then, when invoked for message options inside word, as shown in the image below, select the custom field containing the email address as the “To” field. Proceed with your mail merge.


When in CRM outlook client, you would be able to track these emails in CRM as regular email activities with appropriate regarding object set. Note: The “To” field of the email record created in CRM will be left unresolved. Few more things to know when doing it are:

a. If you have the same email address on other records like account, contact, lead, system user or queue. The “To” field will get resolved to those records.

b. If you have replies coming back for the email you sent via above method, And these received emails getting tracked in CRM, the recipient will not get resolved correctly. But hey, the regarding object will get resolved correctly due to the presence of tracking token. So you should have a functional system.  :o)


Shashi Ranjan

Comments (34)

  1. Roland Pleli says:

    Just one note: If you create a label merge, the document is attached only to one customer not for all in list.

  2. Roger says:

    in your article you say that mail-merge is enabled by default on custom entities but that is not my experience in CRM 4? I’ve got an install with 4 custom entities in it & no sign of mail-merge being available? I’ll certainly look at approach above to swtich it on but can you confirm if this should work by default please?

  3. Ross Lotharius says:

    I am trying to add security around mailmerge templates and only displaying them to certain users through sharing. I am able to share the templates I add but the interface only allows the users to choose a "Personal" or "Organization" template making the shared templates not display. Through the FilteredMailMergeTemplate view I can see the template, so the sharing is working, but the OOTB UI doesn’t display it.

    I’ve logged a suggestion about it here:

    Any plans on fixing this or is it by design?

  4. Shashi Ranjan says:

    Hi Roland Pleli, I am not sure why you see that behaviour for labels. Pl. give more details on what label settings you are selecting.

  5. Shashi Ranjan says:

    Hi Roger,

    The mail merge on custom entity is only available from the grid. Check for the word icon on the grid toolbar for that custom entity. For image see the section "Mail Merge from grid". If you dont see it working pl. raise the issue with the microsoft support.

  6. Shashi Ranjan says:

    Hi Ross Lotharius,

    Thats good point. Sorry, looks like we missed it. But good point is, you can fix it easily by updating the mailmergetemplatepersonal.xml located in the server install directory serverApplicationFiles. Go and remove the filter condition <condition attribute="owninguser" operator="eq-userid" />.

  7. Steven Brom says:

    Hi there. We’re currently planning migrating to CRM 4 with a large CRM 3 customer, and investigating if the current 3rd party Word add-in can be replaced with the CRM 4 standard Mail Merge. Unfortunately (as stated above) its not possible to enable the MailMerge functionality for "Incident" (a standard entity), which is crucial in their process.

    Personally I really don’t understand why it IS possible to enable MailMerge for each custom entity, but not for Incident.

    Sending an acknowledgement for a specific case ("We are informing you that we are working on case XX-YY-ZZ") seems impossible right now.

  8. Steven Brom says:

    Oh, and of course we are hoping that the "Record 1 contained too many data" bug when manually selecting fields for the Mail Merge will be solved in the near future. 🙂

  9. Shashi Ranjan says:

    Hi Steven Brom,

    Enabling mail merge on custom entity was a late addition and supporting more system entities did not make it in. You can try resetting the ismailmergeenabled field on the entity metadata directly.

    As for the bug "Record 1 containing too many data.." its already fixed for crm 5. Also this bug should not stop you from doing your work. You can just dismiss the error and create your templates and upload etc without any further issues.

  10. Tron Keefer says:

    Setting ismailmergeenabled didn’t work for me. I was able to manually run the mail merge on an incident. I’m working on getting the button to show on the toolbar, but this is what I did…

    Navigate to http://<server>/<tenant>/CS/home_cases.aspx.

    Make sure at least one entry exists.

    Replace the URL with javascript:WebMailMerge(‘crmGrid’, 112);

    This will make a direct call to the javascript function that instantiates the mail merge for the incident entity object type of 112.

  11. Shashi,

    Thanks a lot for your reply and your solution worked like a charm.  Is this solution supported?

  12. Bill Smith says:

    I try to initiate a mail merge from a CRM 4 mailing list – and it gives me a dialog asking me to pick an icon? Help appreciated

  13. Jeremy says:

    I am receiving an error when I click ‘ok’ on the first screen that pops up that is labeled ‘Microsoft Dynamics CRM Mail Merge for Microsoft Office Word’. The error is so general ‘An error has occured in Microsoft Dynamics CRM’. Any ideas?

  14. Jeffery Keown says:

    How can I email from a different address, say instead of my own personal address? I want to give the impression of a team effort, rather than one person doing all the mailing.  

  15. dolfi besari says:

    Dear all,

    Recently, i found some trouble on doing quick campaign.

     1.. Open a marketing list. This list consist of 3 member. 1 active with

    email address, 1 active without email address, 1 inactive member.

     2.. I click "Create quick Campaign" and follow the wizard untill this


     When i choose via mail, everythins works fine. There is only 1 activity

    created (1 active member with email address). And there 2 record on excluded

    customer (i.e. 1 inactive member and, 1 active member without email


     3.. problem arise when i choose via mail merge:

     Activity of  two member with email address will be created, even the

    inactive member. The activity of the member without email address ofcourse

    cannot be created but it didn’t appear on the "customer excluded" field.

     So, the problem are The inactive member shouldn’t have ability to create

    activity and the unsent mail should appear on the "customer excluded" field.

    Why doesn’t this work?

    Any of you experience this problem? Please help.

    Thank  you.

  16. Hi Shashi,

    This is a great article. Thank you so much. I do have one question for you: Do you know if its possible to automate the generation of a Mail Merge Template via the SDK code, similar to the way you can with an Email Template? I cant seem to work out a way to do this?

    Thanks so much,

    Catherine Eibner

  17. Danielle Aronson says:

    This information is very helpful.  Is there any way to enable mail merge on additional system entities? In my case I would like to enable mail merge for Orders.


  18. Jack Kuijper says:

    For this you can use WordConnect, it’s integrated in MS CRM 3 and 4 and connected to alle entities (also the order entity).

    If you want, you can include al the products of the order in the generated document automaticly.  See also

  19. Sindy Wong says:

    Anyone has any idea how to merge 1 CRM record to multiple templates?

  20. Jack Kuijper says:

    With WordConnect, you can use textblockes (=Word documents) which automaticly can included in a template. In stead of more then one template, you can use more textblockes.

    You can use also textblockes with a condition, so the included textblockes depends of the data in MS CRM

    see also

  21. Anthony says:

    We’ve just had a problem, if you customise an entity, create a mail merge template for that entity with the extra data fields selected.

    If you then remove those fields from the entity and publish those changes, it encounters an error ‘Error on Page’ (an AJAX problem AFAIK) whenever you try and edit the document. You will have to delete the mail merge template and recreate it. It looks like the field list in a template is kept for customised fields even when they don’t exist!

  22. Wendy says:


    I’m sorry if I have missed the answer on this blog but could someone confirm?

    Is the Activity creation dialogue box only available if opening the Mail Merge template using the Outlook Client?

    Thank you

  23. How do I change the closing on the letter to reflect the owner and not the user? When I select "Owner", I get the Guid and not the name of the owner.

  24. Wendy says:

    You could add the Data Field from the Owner (User) Record Type for the Full Name and then pick that when doing your mail merge.

  25. Jacques Pretorius says:

    Running a mailmerge from the Outlook client, the Address block correctly matches up the company_name attribute to the company field. However when running the mailmerge from the Web client the address block matches the company attribute to the company field which then displayes the GUID in the mailmerge. It seems that the only way around is to edit the address block everytime I run the mailmerge through the web client. Is there anything I could do to rectify this?

  26. dk says:

    Configuring mail merge support for entities.


    I tried enabling IsMailMergeEnabled for Case/Incident Entity using both of the above mentioned techniques But its doesnt work .

    Does anyone has any idea how to go about

    implementing Mail Merge functionality for Case/Incident Entity



  27. Kim says:

    Is there a way to edit the default data field filter?  We have added a few custom fields and would like for them to be included in every Mail Merge Template.  Currently the users have to select these when they create the template.  Would be nice to be able to edit the default fields.

  28. Mehmet Şirin ÇELİK says:

    with the exception of quotes/quote products, you can not reflect fields from child related entities, just parents–so if you were performing a mail merge from accounts and you have a child custom entity related to it, you could not look up fields from that entity for your mail merge.

    I want to get fields from two custom entities which N to 1 relation to account.

    is there any solution?

  29. RUSH says:

    Will anybody tell me the name conventions of CRM mail merge xml data field names which falls in word document  during Mail Merge process?

  30. Mayckel Gouma says:

    The most easy way to enable a mailmerge field for any entity is this;

    – Go to SQL Studio Management

    – Go to the CRM database and open Views > EntityMap  > Right mouse > Open View

    – Search in the column Name the entity where you wan’t to enable MailMerge

    – Go to the last Column ‘IsMailMergeEnabled’ and set the value to true

    – On the CRM server, go to start > run > type ‘iisreset’ and press return.

    – Restart CRM and you mailmerge is enabled for the edited entity

  31. ISA says:

    any idea why custom atrributes if entity contact cannot be defined as transfer field for mail merge? (environment: MS CRM 4.0., MS OFfice 2007, Windows 7 Professioanal)


  32. Robban Eriksson says:


    Is there anyway to disable mailmerge all-to-gether? If disable in Web is it disabled in Outlook-client? Maybe it says how in this text but in a simple way can someone explain it to me!? It would be highly appreciated!!

    Kind regards


  33. AIZ says:

    Hi, is there anyway to create a mail merge with a new entity different from accounts and Contacts?

    Many thansk in advance…

  34. Hi Shashi ranjan,

    I got a requirement as below.

    Create mail merge template,write plugin to open that for the entity with filled data.

    I have created template and by clicking the  doc button on the list of the entity I am able to generate manually.Perhaps that should be done automatically I am going to provide a link when the user clicks on the link document should be opened with data by using the created mail merge template.

    This is very urgent Could you please suggest me  a solution

    you can mail me on

Skip to main content