When mapping fields from Dynamics 365 (Dataverse), you might need to show the data in a specific format, for example, currency or date formats. This article outlines how to set the format of fields inside a DocumentsCorePack (DCP) template.
.
In addition to simply using the format defined in Dynamics 365, custom format options can be directly set via the Field properties from the mscrm-addons.com tab.
Depending on the type of field, different format options are provided:
- Number and money fields
- Date and time fields
- Delete line/row if whole line/row is empty & Delete line/row if a field is empty
- Two Options & OptionSets
- General Formatting in Microsoft Word
.
1. Number and money fields
Follow this step-by-step description to learn how to set the format of number and money fields.
Step 1. Open a Word document and navigate to the ❶ mscrm-addons.com tab. Now place the ❷ cursor in the field you want to format. Click on the ❸ Field properties to open the options. In this example, we have a detail from an invoice, where the currency needs to be adjusted to the country of the customer.
Figure 1: Open Field properties
Step 2. The Field properties window will pop up. The section ❶ Field properties contains the:
- Name (of the field)
- Relation
The section ❷ Formatting options offers the possibility to display the currency in the respective currency of the country. Learn more about Culture Information in DCP here.
❸ Use internal value: When defining a custom format, it is required to ensure that the formatting is applied to the plain value (for example, 10000 instead of the formatted value € 10,000.00). Hence, this setting is automatically checked when defining a format within the Field properties.
Figure 2: Field properties window
Step 3. In the Formatting options, you have to first select the ❶ Culture so that the respective formats for this culture are displayed. Click on the drop-down to select the one you want to apply.
Figure 3: Formatting options – Culture
Step 4. It is then possible to choose the respective ❷ Format to the Culture. As you can see in Figure 4, all Standard Formats are listed. After your selection, the result is displayed in the ❸ Example section. Confirm with OK.
.
Figure 4: Formatting options – Format, Example
2. Date and Time fields
This section shows the formatting options for DateTime fields within the Field properties of the mscrm–addons.com tab.
Step 1. In this example, we have a detail from an invoice, where the date needs to be adjusted to the country of the customer. Place the cursor in the respective field and click the Field properties.
The section ❶ Field properties contains the:
- Name (of the field)
- Relation
The section ❷ Formatting options offers the possibility to display the Date and Time in the respective culture of the country. Learn more about Custom Date and Time Format Strings in DCP here.
❸ Use internal value: Check this box when you use the Formatting options to take over individual formatting for this specific field, and not taken from Dynamics 365.
Figure 2: Field properties window
Step 2. Let´s have a closer look at the Formatting options. First, select the ❶ Culture so that the respective formats for this culture are displayed. Click on the drop-down to select the one you want to apply.
Figure 3: Formatting options – Culture
Step 3: It is then possible to choose the respective ❷ Format to the Culture. As you can see in Figure 4, all Standard Formats are listed. After your selection, the result is displayed in the ❸ Example section. Confirm with OK.
Figure 4: Formatting options – Format, Example
.
3. Delete line/row if whole line/row is empty & Delete line/row if a field is empty
To keep your documents compact, it is recommended to avoid empty lines within your documents. For example, think of an address block where some customers use the Address Line 2 field, but others do not. To ensure a compact output, you want to avoid empty lines for those who do not use the field.
There are two options:
- Delete line/row if whole line/row is empty: If the value of the selected field, as well as all other fields within the same line, are empty in DataVerse, the line will be removed.
- Delete line/row if this field is empty: If the value of the selected field is empty, the whole line is removed independent of other content in the same line.
How it works
Open a Word document and navigate to the ❶ mscrm-addons.com tab. Place the cursor in the field you want to format. Click on the Field properties to open the options.
If the value of the selected field and all other fields within the same row in DataVerse are empty, take Option A.
If you need the whole line removed when only one selected field is empty, take Option B.
Figure 5: Select Option A or Option B
Sample result:
.
4. Two Options & OptionSets
For OptionSets (Two Options), the properties allow you to either use the internal value or display of the selected option.
Use internal value: When defining a custom format, it is required to ensure that the formatting is applied to the plain value, for example, 10000 instead of the formatted value € 10,000.00. Hence, this setting is automatically checked when defining a format within the Field properties.
.
5. General Formatting in Microsoft Word
Word provides different options to format fields. The following article provides an overview on possibilities provided.
That’s it! We appreciate your feedback! Please share your thoughts by sending an e-Mail to support@mscrm-addons.com.