Category Archives: JavaScript

Dynamics 365 (CRM) Image Loader

This article describes how to create a simple Dynamics 365 (CRM) web resource that would allow us to display images based on a dynamics URL. This URL would be stored in an entity attribute and the name of the attribute would passed as a parameter to the web resource.

Preparing the demo for EMEA Summit 2017, I needed to display some logos and organisations images (covers) in the Account entity.

Let me show you a picture and you will immediately get what I mean:

CRMUG_EMEA_Summit2017_ImageLoader_imagesAccountForm

In our demo, we used the account entity to track the different NGOs / charities that would be part of the end solution. Each charity would have their own different logo and image cover that would be, later on, displayed in the PowerApp we also prepared.

Those images would be defined based on the following account attributes:

CRMUG_EMEA_Summit2017_ImageLoader_imageAttributesAccountForm

Solution: A simple web resource that would allow us to specify the attribute name with the URL as a parameter.

Below you can see the form definition, which got 2 web resources to host those previous images:

CRMUG_EMEA_Summit2017_ImageLoader_accountForm_webresource

If we now look at the properties of each web resource, we would see they are using the same HTML web resource behind the scene, but the parameter we are passing is different. The parameter is actually the attribute name to feed the image:

CRMUG_EMEA_Summit2017_ImageLoader_webresource_logo_parameter

And the other one:

CRMUG_EMEA_Summit2017_ImageLoader_webresource_cover_parameter

If you want to see the code of that HTML web resource, have a look at my GitHub link.

Hope you find it useful 🙂

Advertisements