Conditional Images in DocumentsCorePack

John Towgood, 21 September 2018

Documents CorePack add-on provides functionality of transforming data/information from Dynamics 365 into professionally looking documents. The Documents CorePack Client provides an easy way of generating templates using standard Microsoft Word layouts combined with Documents CorePack Template Designer.

When designing a template, displaying images provides good visual context to a document and displaying different images base on conditionals are more informative than text. The standard way Documents CorePack achieves conditional statement is by using if statement placeholders

Example

Dear {if”<<salutation>>”=”Mr.” “Mister” “Misses”} <<lastname>>

But since an if statement placeholder only works with text and not images, this way would not achieve conditional base images. After investigating other functionalities that Documents CorePack provides, I came across Condition field which can be used to display conditional images.

To demonstrate, in Dynamics 365 I have a Satisfaction field against an Account which is an option set field containing the following satisfaction types base on Facebooks emojis:

image

In the Document Template the Satisfaction field will be represented by one of the following Facebooks emojis images:

image

Here are the steps required to implement conditional images against the Satisfaction field:
1. Select Insert Computed Item > Insert Condition field

image

2. Create an IsLike condition field, where in the designer section you select condition where Satisfaction equals Like and click on OK

image

3. An IsLike condition field will be created, Insert Picture into the condition field

image

4. Adjust the size of the image

image

5. Repeat steps 1-4 for the other Satisfaction conditions

image

6. Generate Document

image

Inserting images into a Condition field offers a way of achieving conditional base images which provides good visual context.