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 clienthttps://4.bp.blogspot.com/-MyCOusJre50/WkJP_kTgiSI/AAAAAAAAA_w/Pl7za2lpYaUlYI0aUu7rkqtzGqejMpHoACEwYBhgL/s1600/Capture.PNGI tried changing code but couldn't fix for UCI client.Please help!