Skip to content
Microsoft Dynamics 365

Arne had a great post before covering the basic of mail merge in CRM. Check it out if you are new to mail merge (http://blogs.msdn.com/crm/archive/2008/01/15/mscrm-4-0-mail-merge-basics.aspx)

In this article I would like to take you though an important feature “Print quote for customer”. This is essentially a mail merge run on the Quote product entity but available from Quote entity. The Quote entity has one to n relationship with Quote product entity.

The goal of this feature is to enable users to generate a single document containing the summary of all quote products associated with the quote. This single document can be printed or handed to the customer.

There are few subtle differences in how this feature differs from the other mail merge implementations in CRM.

a) Field selection for data source field.

    – Like mail merge from other entities, the user can select fields from the primary entity in this case “quote”, its related entities and the current user fields.

    – Then they also have an option of selecting fields from associated quote product and related product of associated quote product. This is the only place where we do reverse relationship look up and multiple hops in the relationship tree for fetching data for data source.

clip_image002

b) Merge type (or) Document type (as Microsoft Word calls it).

    – The document type is set to directory. A MSDN article on using directory mail merge can be found at http://support.microsoft.com/kb/294693

clip_image004

c) Generates one final document.

    – As compared to others (letter, labels etc) where one document for each selected row in the data source is created, the directory mail merge will merge all data from the data source into one document.

d) Use of Word fields in the mail document.

    – The directory mail mere will not retain any headers and footers information. So the only way to insert them is via the use or Word fields like MERGESEQ and IF conditions.

    – A MSDN article on word fields can be found at http://msdn2.microsoft.com/en-us/library/aa163918(office.10).aspx

Note: The Microsoft Word shortcut for hide/show of merge fields is Alt+F9

e) Special “LastItem” field in the data source.

    – There is a special field with name “LastItem” added to exported data source. The value of this column is 0 or 1; where 1 represent that last record in the data source.

    – The header information of the document can be inserted using a condition like { IF {MERGESEQ = “1” “…”} but there is no support for identifying the last record in the mail merge of which the footer information can be inserted.

    – The last item field comes handy in this situation. It enables users to insert footer information into the document by placing a condition like { IF { MERGEFIELD “LastItem” = “1” “…”}.

    – Check out the default mail merge template “Quote for customer” that ships with CRM for an example on how it’s used.

clip_image006

f) Tracking in CRM.

    – Generated mail merged documents can be tracked into CRM when mail merge is run from the outlook client. The tracking in this case is done by creating a task record on the quote entity from which the functionality is invoked. The final generated document is located as an attachment on the created task.

clip_image008

g) Mail merge template.

    – Like other mail merges, user can upload mail merge template documents to CRM that can be shared and used in latter “Print quote for customer” runs. The associated entity for these mail merge template records is set to “Quote”.

clip_image010

Cheers,

Shashi Ranjan

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!