The Microsoft Dynamics CRM Blog
News and views from the Microsoft Dynamics CRM Team

Mail Merge and more...

Mail Merge and more...

  • Comments 34

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.

shashi1

- 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.

clip_image004

- 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.

clip_image006

- 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.

clip_image008

- 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.

clip_image010

- 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.

clip_image012

- 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.

clip_image014

- 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.

clip_image016

From quick campaign wizard.

clip_image018

- 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.

clip_image020

clip_image022

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.

clip_image024

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)

{

try

{

// 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;

svc.Execute(request1);

// Confirm results.

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

// Log.

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

}

catch (Exception e)

{

Console.WriteLine(e);

}

}

- If you need more information on using the SDK you can download the CRM 4.0 SDK from http://www.microsoft.com/downloads/details.aspx?FamilyId=82E632A7-FAF9-41E0-8EC1-A2662AAE9DFB&displaylang=en

- 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 customizations.zip
  • 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.

clip_image026

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)

Cheers,

Shashi Ranjan

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

  • 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?

  • 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: http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?dg=microsoft.public.crm&tid=54b449fb-0356-4cde-a4a4-1383def3f43d&cat=&lang=en&cr=US&sloc=en-us&p=1

    Any plans on fixing this or is it by design?

  • 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.

  • 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.

  • 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 server\ApplicationFiles. Go and remove the filter condition <condition attribute="owninguser" operator="eq-userid" />.

  • 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.

  • 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. :)

  • 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.

  • 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.

  • Shashi,

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

  • bill@myzan.com

    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

  • 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?

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

  • 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

    page:

     http://i51.photobucket.com/albums/f381/organisme/Kerjoan/CRM/mailmergemethod.jpg

     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

    address).

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

     http://i51.photobucket.com/albums/f381/organisme/Kerjoan/CRM/mailmergemethoderror.jpg

     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.

Page 1 of 3 (34 items) 123
Leave a Comment
  • Please add 2 and 4 and type the answer here:
  • Post