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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
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,995 Moderator

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!

I have the same question (0)
  • Suggested answer
    Henry J. Profile Picture
    5,237 on at

    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

  • Suggested answer
    AJ-22040756-0 Profile Picture
    Microsoft Employee on at

    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. 

  • Mira Ghaly Profile Picture
    75 on at

    Hi 

    Anyone have manged to get this working?

  • Suggested answer
    Henry J. Profile Picture
    5,237 on at

    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.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
11manish Profile Picture

11manish 92 Super User 2026 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 50 Super User 2026 Season 2

#3
ParthPatel249 Profile Picture

ParthPatel249 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans