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

Notifications

Announcements

No record found.

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
    587 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
iampranjal Profile Picture

iampranjal 41

#2
Martin Dráb Profile Picture

Martin Dráb 38 Most Valuable Professional

#3
Satyam Prakash Profile Picture

Satyam Prakash 35

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans