Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Web Resources on List Views not affected by related entities

Posted on by Microsoft Employee

I have what we call an "Interesting Moment" entity which pulls activity data from our marketing system into our Dynamics system (2016/365 on prem).  Also pulled from marketing is a urgency and a relative score which is kept on the contact entity record.   I have a web resource that displays on contact entity list views the relative score and urgency in the form of icons displaying how hot or cold the contact is based on various marketing scores.  I want to display these same graphics on any interesting moment list views relating the value from the contact record.   The web resource works fine on the contact entity, but does not function when the field is a related entity.  I checked the rowData and saw that on the related entity pull it's affixing the contact entity GUID before the field name.  Where on the contact entity the field is mkt_relativescore_Value on the related pull it is a_79b92758721ee91180dc00155d649803.mkt_relativescore_Value.  However if I hardcode my web resource to look at a_79b92758721ee91180dc00155d649803.mkt_relativescore_Value then it doesn't function at all on the related entity.   The rowData displays the value correctly, but the coldata will not properly apply that value to select the proper image.  My code is as follows:

function bestbetstaricons(rowData) { 
    var str = JSON.parse(rowData); 
    var coldata = str.a_79b92758721ee91180dc00155d649803.mkt_relativescore_Value;
    var imgName = ""; 
    var tooltip = ""; 
    switch (parseInt(coldata,10)) {
        case 1: 
            imgName = "star1";  
            tooltip = "Medium Quality";
            break; 
        case 2: 
            imgName = "star2"; 
             tooltip = "Good Quality"; 
             break; 
        case 3: 
            imgName = "star3";  
            tooltip = "Best Quality";
            break; 
        default: 
            imgName = "star0"; 
            tooltip = "Low Quality"; 
            break; 
    } 
    var resultarray = [imgName, tooltip]; 
    return resultarray; 

Any Suggestions as to why my code might not be functioning properly?

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Web Resources on List Views not affected by related entities

    Figured it out.  The key was having to do a full replace on the entire line with the field name as it is on the Contact entity.  as so:

    function bestbetfireicons(rowData) {      

       rowData = rowData.replace('"a_79b92758721ee91180dc00155d649803.mkt_urgency_Value"','"mkt_urgency_Value"');

       var str = JSON.parse(rowData);  

       var coldata = str.mkt_urgency_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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans