Dynamic images in document templates

Hi, The documentation talks about dynamic images in document templates https://docs.mendix.com/refguide/dynamic-image-document-template#1-introduction. I would like the image to be different depending on conditions, i.e user or application function. How can I accomplish that? Other examples of contextual images would be user avatars or company logos. Kind regards Johan   Edit: Joost answer is what I used. I missed to look carefully under properties in the dynamic image viewer where one sets the data source.
2 answers

Hi Johan,

the document template will most likely be based on an object of a certain entity (e.g. the user, the company, or an order). The easiest way to introduce dynamic images is by using a specific object of an entity (that inherits from) System.Image, and associate this object to the context object that is passed to the template. Using the “Dynamic image viewer” widget it should be rather straightforward to display the image in a template.

For example, an order object will most likely have an association to a ‘customer’ object, which in turn is associated to a ‘companylogo’ object..

Hope this helps!

Regards, Joost


Hi johan

You need to use the dynamic image view instead of the static, which can be found next to the static image viewer in the tool box