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

I have the same question (0)
  • 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
ManoVerse Profile Picture

ManoVerse 55 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans