web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

JavaScript Icon not working in CRM Views

(0) ShareShare
ReportReport
Posted on by 60

Good day and thank you for your interest.

I am looking to implement Icons on CRM Views and CRM Dashboards. I followed the Microsoft documentation found HERE which have sample JS code for this requirement. For my scenario, I simplfied the code but I am still getting an error on when the icon is rendered in the browser. Code is pasted at the botton,

ICON ERROR:

JSIcon.PNG

CODE: 

function displayIconTooltip(rowData, userLCID) {      
    var str = JSON.parse(rowData);  
    var coldata = str.cr66c_rank_Value;  
    var imgName = "";    
    switch (parseInt(coldata,10)) {
        case 1:  
            imgName = "highpriority16svg";    
            break;  

        case 2:  
            imgName = "mediumpriority16svg";  
            break;  

        case 3:  
            imgName = "lowpriority16svg";    
            break;  

        default:  
            imgName = "";    
            break;  
    }  
    var resultarray = [imgName];  
    return resultarray;  
}

Any help on this would be greatly appreciated. Thank you and best regards.

- Arslan

  • Verified answer
    Tamilarasu Arunachalam Profile Picture
    593 on at

    function addIconToView(rowData, userLCID) {
        var data = JSON.parse(rowData);
        var approve = data.comp_approve_Value;
        var imgTooltip = "";
        var imgWebResource = "";
        switch (approve) {
            case 1:
                imgWebResource = "comp_imgg";
                imgTooltip = approve;
                break;
            default:
                imgWebResource = "comp_imgg";
                imgTooltip = approve;
                break;
        }
        return [imgWebResource, imgTooltip];
    }  

    pastedimage1667213304601v1.png

    The above code works perfectly fine for me.

    Try giving tooltip for that image

    Thanks,

    Tamilarasu

  • Suggested answer
    Arslan001 Profile Picture
    60 on at

    Thank you Tamilarasu.

    It is working perfectly. I was using the Display name of the web resource as opposed to the logical name of the web resource. For me it worked with the logical resource. Thank you again, appreciate your help.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 42 Super User 2026 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 35 Super User 2026 Season 2

#3
Travis South Profile Picture

Travis South 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans