Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Dynamics CRM - Dynamically change row color in grid view UCI Client

(0) ShareShare
ReportReport
Posted on by 28,959 Super User 2024 Season 1

Hello, 

We have a requirement to change Lead Home Grid row backgrond color based on field value. For Example Rating -Hot show Red color and for other values change to different color.

I have found code which is working fine in Web client read only grid. However we have a requirement to do this in UCI. below Blog which is working in Web client.

Dynamics CRM - Dynamically change row color in grid view


function showLeadStatus(rowData, userLCID) {

if(rowData ==null|| rowData =='undefined')return;

// read rowdata
var str = JSON.parse(rowData);
// get leads status
var coldata = str.statuscode_Value;
//get row/record guid
var rowId = str.RowId;

if(coldata ==null|| coldata =='undefined'|| coldata.length < 1)return;

switch(coldata) {

case 4: //if 'Lost

// This is the way to get the whole row
// This syntax might get changed in your case based upon requirement
// First you need to find the 'td' tag (by doing F12 in gridview) based on the attribute you want to color the grid view
// For Example, here I am using lead status field (statusreason) and the 'td' of
//status reason field is span that is why I have used span to get the 'td' then used the 'closest' method to get the 'tr' of that 'td' in order to make the row colorful

$('span:contains("Lost")').closest('tr').css('background-color', 'coral')
$('span:contains("Lost")').closest('tr').css('color', 'white')
break;
case 3: //if 'qualified':

$('span:contains("Qualified")').closest('tr').css('background-color', 'greenyellow')
$('span:contains("Qualified")').closest('tr').css('color', 'white')
break;
case 1: //if 'new':

$('span:contains("New")').closest('tr').css('background-color', 'yellow')
break;

default:
break;
}
}



Grid visualization on Web client
https://4.bp.blogspot.com/-MyCOusJre50/WkJP_kTgiSI/AAAAAAAAA_w/Pl7za2lpYaUlYI0aUu7rkqtzGqejMpHoACEwYBhgL/s1600/Capture.PNG


I tried changing code but couldn't fix for UCI client.
Please help!

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: Dynamics CRM - Dynamically change row color in grid view UCI Client

    Again, this isn't supported.
    This means that even if it was technically achievable through a workaround, this type of customization could break without notice and negatively impact your production by potentially blocking some of your business processes.

    Please refer to my previous comment for supported alternatives that could meet the same functional outcome.

  • Mira Ghaly Profile Picture
    Mira Ghaly 75 on at
    RE: Dynamics CRM - Dynamically change row color in grid view UCI Client

    Hi 

    Anyone have manged to get this working?

  • Suggested answer
    RE: Dynamics CRM - Dynamically change row color in grid view UCI Client

    Hi Partner

    This is an unsupported customization, We would recommend not to use this approach.

    Creating a  PCF Controls can surely help out here to achieve this. 

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: Dynamics CRM - Dynamically change row color in grid view UCI Client

    Hello,

    This type of customization is unsupported, hence why this is breaking when an updating to Unified Interface.
    I would advise against it, as this type of customization can break without notice when the Unified Interface gets updated.

    As workarounds, you could

    Henry

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans