Display product images in a quote in Dynamics 365

We recently had a requirement to display the out of the box product images within a quote generated by the standard Dynamics document generation process. The expected output would be similar to the below.

quoteimage

Unfortunately, the document generation wizard in Dynamics doesnt go beyond a depth of 2 entities. With the document template based on the quote entity, the product entity (3 levels down Quote -> Quote Detail -> Product) attributes arent accessible within the template data.

There are a number of 3rd party Dynamics add-ons that can cater to this requirement but I wanted to see if I could find a robust solution without using additional add-ons.

My thinking for the solution I wanted to explore was as follows:

  • Have an image field on the quote line entity that is populated by the image of the product associated to the quote line record.
  • Map this custom field to the word template

Below are the actual steps I took.

  1. Created a custom field 'Product Image Binary' on the 'Quote Line ' entity. This field type was obviously 'Multiple Lines of Text' and I made the maximum length the biggest size I could. This would be the field thats populated by the products image. Unfortunately, you cannot create 'Image' type fields on OOTB entities.

cap1

  1. Created a Microsoft Flow that fires on create of the 'Quote Line' entity record or on change of the Product field on that entity. This Flow would then, assuming the product associated the line item has an image, convert the image to its binary format and then save that into the field created in Step 1. For testing purposes, I created 2 Flows (one for create and the other for update) and duplicated the logic in each. Ideally, these Flow triggers would call another Flow or process that has this logic consolidated in one place. Below is the structure of my 'On Change' Flow

flowlogic

The key item is the 'Composite' action, in which I set the value to the binary format of the product image

composite

I then map that output to my custom field in the 'Update' step

composite2

  1. In my word template, when mapping my custom field into the word document, I selected the 'Picture' type for the field mapping

imagecontrol

Your template field mapping would look similar to the below, depending ofcourse on your requirements, for your image mapping.

template

I uploaded the saved template back into Dynamics...and that was it! When I generated a quote for demonstration purposes, below shows the output with the quote image displayed in the quote

quoteimagedoc

The solution worked well and effeciently during my testing. Overall I (and the customer more importantly!) was pleased with the solution outcomes. There are some elements that need to be enhanced for this solution to be production ready. For example, in the Flows, handling of products with no images needs to be factored in.

The next step in this process would likely be to convert this quote to a pdf but luckily I have a blog post on that 😉