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


Now, you'll add your JavaScript as the final web resource.



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.



Thank you for visiting this blog 🙏

Comments

Popular posts from this blog

How to update 100000(hundred thousand) records with power automate flow by using chunk expression, Split the list and pass onto child flows.

How to keep flows remain on if the flows don't run for 90 days

D365 CRM-Change Entity translations(Sub area) in Modern driven app.