Add custom Icons in D365 CRM View
To show custom icons on the view, fist you need to Create the new graphic files needed for your customization. Recommend an icon size of 16x16 pixels.
Graphic format you've used to save your graphic file (PNG, JPEG, or GIF)
Now, you'll upload your custom graphics, one at a time, as web resources
Select Text Editor (next to the Type setting) to open a text-editor window. Paste your JavaScript code here and select OK to save it.
please use the below script, please change the code according to your requirement.
"use strict";
function displayIconTooltip(rowData, userLCID) {
var str = JSON.parse(rowData);
var coldata = str.leadqualitycode_Value;
var imgName = "";
var tooltip = "";
switch (parseInt(coldata,10)) {
case 1:
imgName = "cr0b9_hot";
switch (userLCID) {
case 1036:
tooltip = "Hot";
break;
default:
tooltip = "Lead is Hot";
break;
}
break;
case 2:
imgName = "cr0b9_Warm";
switch (userLCID) {
case 1036:
tooltip = "Warm";
break;
default:
tooltip = "Lead is Warm";
break;
}
break;
case 3:
imgName = "cr0b9_cold";
switch (userLCID) {
case 1036:
tooltip = "Cold";
break;
default:
tooltip = "Lead is Cold";
break;
}
break;
default:
imgName = "";
tooltip = "";
break;
}
var resultarray = [imgName, tooltip];
return resultarray;
}
Go to the view you want to display these icons, Open the required column, select the web resource and enter function name and enter function name.
Save and close, publish on the entity level, now go and see the view, you can see the icons.
Comments
Post a Comment