Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Adding Web Resources to Views

(0) ShareShare
ReportReport
Posted on by 365

I am trying to add a webressource into a view to show a yes/no icons marks but it doesn't work i already showing other icons on other columns but is webresources works on boolean fields ?

this is my code

function yesOrNoToolTip(rowData, userLCID) {    
    var str2 = JSON.parse(rowData);
    var col_data2 = str.ans_reserver_Value;
    var imgName2 = "";
    var tooltip2 = "{" + col_data2 +"}";

    switch (col_data2) {
       case 0:
          imgName2 = "tool_no";
          tooltip2 = "No";
          break;
       case 1:
         imgName2 = "tool_yes";
         tooltip2 = "Yes";
         break;
      
    }
    var resultarray2 = [imgName2, tooltip2];
    return resultarray2;
}

*This post is locked for comments

  • Suggested answer
    Anas Rafik Profile Picture
    365 on at
    RE: Adding Web Resources to Views

    This is the working code :

    function yesOrNoToolTip(rowData, userLCID) {  
    
       var str = JSON.parse(rowData);
    
       var col_data = str.ans_reserver_Value;
    
       var imgName = "";
    
       var tooltip = "{"   col_data  "}";
    
       switch (col_data) {
    
          case false:
    
            imgName = "tool_no";
    
            tooltip = "No";
    
            break;
    
          case true:
    
             imgName = "tool_yes";
    
             tooltip = "Yes";
    
             break;
    
       }
    
       var resultarray = [imgName, tooltip];
    
       return resultarray;
    
    } // END

  • Suggested answer
    Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: Adding Web Resources to Views

    Hi,

    Were you able to fix this issue?

    Please provide working code so that it will be helpful to other who might be facing the same issue.

    If found helpful, Please mark my answer verified.

  • Suggested answer
    Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: Adding Web Resources to Views

    HI,

    I don't think this is possible as of now.

    If found helpful, Please mark my answer verified.

  • Community Member Profile Picture
    on at
    RE: Adding Web Resources to Views

    Hi, Is there a way to add webresources to personal views?

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Adding Web Resources to Views

    Hi,

    You do have a type in your script (str). Also, Two options is different than optionset value i.e. two option will return true/false so you need to use if and add you logic. Something like this-

    =============

    function yesOrNoToolTip(rowData, userLCID) {

       var str = JSON.parse(rowData);

       var col_data2 = str.ans_reserver_Value;

       var imgName2 = "";

       var tooltip2 = "{" + col_data2 + "}";

       if (col_data2) {

           imgName2 = "tool_yes";

           tooltip2 = "Yes";

       }

       else {

           imgName2 = "tool_no";

           tooltip2 = "No";

       }

       var resultarray2 = [imgName2, tooltip2];

       return resultarray2;

    }

    =================

    Hope this helps.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Adding Web Resources to Views

    Hi,

    Try with this - Make sure you are using  correct img web-resource path in the red highlighted.

                function yesOrNoToolTip(rowData, userLCID) {    
                    var str2 = JSON.parse(rowData);
                    var col_data2 = str2.ans_reserver_Value;
                    var imgName2 = "";
                    var tooltip2 = "{" + col_data2 +"}";
    
                    switch (col_data2) {
                        case 0:
                            imgName2 = "tool_no";
                            tooltip2 = "No";
                            break;
                        case 1:
                            imgName2 = "tool_yes";
                            tooltip2 = "Yes";
                            break;
          
                    }
                    var resultarray2 = [imgName2, tooltip2];
                    return resultarray2;
                }

    You can refer below article  -

    https://community.dynamics.com/crm/b/mscrmshop/archive/2016/12/13/adding-icons-and-tooltips-to-grid-column-in-dynamics-365

  • Verified answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at
    RE: Adding Web Resources to Views

    It will work for 2 options Boolean fields as well.

    You have a typo in your code. Correct “str” into “str2” in 2nd line below:

    var str2 = JSON.parse(rowData);

    var col_data2 = str2.ans_reserver_Value;

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans