When you execute a Mail Merge in Microsoft CRM and include Date/Fields in the merge, that field exports the data in the following format: "04/29/2009 12:30 PM". The time is always exported as part of the merge even if the attribute in CRM is configured to display the Date only. Well what if you wanted to change the formatting of a date field in your merge? In CRM there are Merge Codes that you can use to format the output of data when performing a mail merge.
Here are a few samples of how you can use Merge Codes to format Date Fields:
Formatting a Date Field to Only Display the Date:
- In the Microsoft Word document generated for your mail merge, add the Date Field to the document (for example Created_On date for a record in CRM)
- Right-Click the merge field and Click Toggle Field Codes
- The display of the field will have changed from <<CREATED_ON>> to {MERGEFIELD CREATED_ON}
- Before the }, add the following: \@ "mm/dd/yyyy", now your field should look like this {MERGEFIELD CREATED_ON \@ "mm/dd/yyyy"}
- Now when you go to the next step of your Merge and preview the document you will see that the time is no longer displayed.
Other Field Codes for Formatting Dates in a CRM Mail Merge:
- \@ "MMMM DD, YYYY" - Formats the Date as: April 29, 2009
CheatSheet for Date Formatting Codes:
- dd - day as two numbers e.g. 01
- d - single figures drop the zero e.g. 1.
- dddd - day of the week e.g. Tuesday
- ddd - day of the week in three letters e.g. Tue
- MM - month as two figures e.g. 04
- M - single figures drop the zero e.g. 4
- MMMM - month in words e.g. April
- MMM - month as three letters e.g. Apr
- yy - year in two figures e.g. 05
- yyyy - year in four figures e.g. 2005
There are Merge Codes available to format data of all types, Numbers, Money fields etc.
Jeremy