Based on some of the previous examples, this recipe shows a very basic way to reference a contact picture from an external source. This source could be anything from an internal repository to any public image hosting site. Also, you can use the same approach to load images to any entity. In the following recipes, we will delve deeper into referencing images from within the system.
For this example, we will be using an existing solution. Alternatively, we can create a new solution. We will customize the Contact entity.
function AddContactPicture() { var _imageURL = Xrm.Page.getAttribute("new_profileimage").getValue(); Xrm.Page.getControl("WebResource_ContactPicture").setSrc(_imageURL); }
WebResource_ContactPicture
.new_profileimage
.AddContactPicture()
function to the OnChange
event of the previously created text field, as well as to the OnLoad
event of the form.The defined script loads a URL to an image and places that image in our form-defined web control. Formatting the text field as URL adds the necessary validation on the field, so we don't end up with unexpected user input.
18.217.2.223