Howto add item images to the Sales quote report

Not often, but it can be, that a client wants product pics in the lines of a report, e.g. the sales quote is a candidate for that. So the client can present his products in a more convincing way. 😉

I researched for a solution in Business Central, but did not find any solution, especially when using a word report. But i found my own way, as always.

For that follow these steps:

1) Copy the standard sales quote report, also the layout to a new custom report, set new object id (e.g. 50100) and name (e.g. “Custom Sales Quote”), so that you can make the needed changes. save, compile, publish the extension. for that steps follow my last post.

2) add variable TenantMedia: record “Tenant Media” to the global report variables

3) add new dataitem(Item;Item) after the last column of dataitem “Line” (Sales Line)

4) add the typical properties to connect the dataitems Line and Item via field “No.”

5) add column(Picture;TenantMedia.Content) to the new dataitem for viewing the item picture in the line

6) in trigger OnAfterGetrecord of dataitem “Line” add new local variable “Item: record item”.
at the end of the trigger’s code add:
if item.picture.count > 0 then begin

remark: to load the picture data within the OnAfterGetrecord trigger in new dataitem “Item” won’t work, the data is loaded to late to be shown in the line.

7) edit the word layout in vs-code using ms word, activate the developer tools menu in word, activate the xml structure to view the fields structure

8) add new column in the lines matrix. set the column heading to “Picture”, set the cursor into the new data cell in the new column, add new field Header/Line/Item/Picture as Picture (type) into the new data cell. save the word report, close word, compile and publish the extension. replace the sales quote no. in “report selection” to the new report.


Great, isn’t it?