This article provides a guide on how to add the product image of an item to a report on the line level. The product image is the thumbnail image that can be added in standard D365 to item masters. Oftentimes, it is beneficial to have these images in a report.
Example of the Product image on an item master:
The product image is an attachment that is saved to the Docuref table. The reference table is the InventTable.
1. Go to your report in Lasernet > Common > Reports and select the Query wizard.
2. Select Next until you get to the Tables.
3. Add the InventTable to your report. This will depend on your report but the InventTable has many tables it is related to. Add the InventTable to your report's line level. Below is an example:
4. Add Docuref to InventTable. The relation should be as shown below:
5. Select Next and add getFileContentAsBase64String() or getFileContentAsContainer(). Finish the wizard.
6. Open the report's Structure and navigate to the Docuref Detail section. If you are using getFileContentAsBase64String() leave it as type String. If you are using getFileContentAsContainer(), set it to type Base64 file.
7. Close the Structure, run the report and review the XML. The field(s) for the image are added a Base 64 Strings.
8. Download the grab file in Lasernet Form Editor and map the image to the report. This can be done by selecting Image > Local > Base 64.
9. Select an image field and position it as desired.
Available starting with version 6.8.0
With this version, it is now possible to directly use a field/method like EcoResProduct.ProductImage() for adding images. This approach makes it much simpler to add images/pictures.