Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

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

(0) ShareShare
ReportReport
Posted on by 28,961 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!

  • Suggested answer
    necsa Profile Picture
    necsa 3,455 on at
  • Mahmoudr Profile Picture
    Mahmoudr on at
    RE: Dynamics CRM - Dynamically change row color in grid view UCI Client

    Hello PhuocLe  , can you please if teh above can be done of Dynamics 365 UCI Grid ? if so how can that be done .

  • Yasaswini Uppala Profile Picture
    Yasaswini Uppala 30 on at
    RE: Dynamics CRM - Dynamically change row color in grid view UCI Client

    Hello PhuocLe,

    Yes, i just want the text color to get changed, it is okay if background color doesn't change.

    Thanks!

  • Suggested answer
    PhuocLV Profile Picture
    PhuocLV 347 on at
    RE: Dynamics CRM - Dynamically change row color in grid view UCI Client

    Are you looking this solution ?

    2020_2D00_10_2D00_08_5F00_22h41_5F00_27.gif

  • Yasaswini Uppala Profile Picture
    Yasaswini Uppala 30 on at
    RE: Dynamics CRM - Dynamically change row color in grid view UCI Client

    Hello Bipin,

    I have the same requirement. May I know the approach you have followed to implement this?

    Thanks!

    Yasaswini Uppala.

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

    Hi Partner

    As suggested in the thread community.dynamics.com/.../1002247

    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
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Dynamics CRM - Dynamically change row color in grid view UCI Client

    Hello,

    What you are trying to perform is unsupported. I would recommend not to use that approach. If you anyway want to colorize your grids - create a PCF that will do that for you. Good luck.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,403 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans