Sage CRM 2021: Using the Client Side API to show a field value as an icon (gif).

A customer had a need to display field values of selection lists as icons in a summary page.

Within the admin screens, it is possible to cause a column in a list to show selection field values as a gif as you can see in the image below:

This is explained in the documentation.

We can see in this example the Oppo_Status field is displayed as an image. The value of the field matches one of the images stored on the server.

C:\Program Files (x86)\Sage\CRM\[installname]\WWWRoot\Themes\Img\Ergonomic\Choices

Fields in screens do not have a meta data control to show the select as a gif. But we can use the client side API.

For example we can add a new javascript file into the custom JavaScript folder

C:\Program Files (x86)\Sage\CRM\[installname]\WWWRoot\js\custom

var showFieldValueAsGIF = function (fieldname) {
//Usage: showFieldValueAsGIF("oppo_status");
var strfieldname = crm.fields(fieldname);
strfieldname.urlToImage({ src: crm.installUrl() + "Themes/img/ergonomic/choices/" + fieldname + "/" + strfieldname.value() + ".gif" })

crm.ready(function () {
var contextInfo = crm.getArgs();
// crm.infoMessage(contextInfo.Act);

//Set up Oppo Summary Screen
if (contextInfo.Act == "260") {

//Change the display of fields to show their value as a gif

Once the new JavaScript file is loaded into the screens this will change the display of the fields.