CRM 2011: color-coding records in the grid

This question is answered

Hello all.

Please do not get upset that I am doing something unsupported. Without this feature we can't upgrade from 4.0 to 2011!

We need to color-code a custom column "Rating" on Leads view that works in IE .  If record has attribute  "hot",  then this record must have red background in this column.

We had this working in 4.0, but now I need to fix the code to work in 2011. 

I've added simple in  MS Dynamics CRM/CRMWeb/_root/HomePage.aspx:

<body class="stage" onload="alterGridRecords()" >

function alterGridRecords(){   ....

var grid = document.getElementById("gridBodyTable").lastChild;

var gridTH = document.getElementById("gridBodyTable")

var headers = gridTH.getElementsByTagName("TH");

for (var n = 0; n < headers.length; n++)

   {   var header = headers[n];     

       if (header.innerText == "Color Code"){

           for (var i = 0; i < grid.childNodes.length; i++)  {

               if (grid.childNodes[i].childNodes[n].innerText=='Hot')

                    {grid.childNodes[i].childNodes[n].style.backgroundColor="ff6666";} ....

It works perfectly but only when I load Leads for the first time. If I switch to another view and then go back to this one, there is no color in my column.  I think the code is in the wrong place. I'd like it to work on all the Lead's grids .

Please help.

Verified Answer
All Replies
  • Hello,

    Would this suffice?

    community.dynamics.com/.../increasing-user-adoption-with-microsoft-crm-for-outlook-view-settings.aspx

  • Great post, but this works only in Outlook. Many of our sales access CRM via IE.

    What is possible in this case?

  • I don't know any other options.

    Sorry.

  • It is actually not true that it only works with outlook.

    It is true that you need to create the conditional formatting in Outlook, but once saved, the conditonal formatting will actually be stored in the user settings and be displayed in the IE as well.

    You can even share the view and other users will experience the conditional formatting as well...

    So I would definetly go with the conditional formatting and then share the views you are trying to create. You can either share to a number of users or if you are using teams, share it to those.

    Rune Daub

    Senior CRM Business Consultant

    http://www.xrmmanagement.com

  • hi rune,

    share to users in same network,, or share to users/teams in crm?

    i ask because if you can share it in crm we maybe can deploy it in solutions?

    thx gr.pit

  • Rune,

    I'm not understanding what you are talking about.

    How would Outlook Conditional Formatting changes would be visible in the CRM Web Client?

  • Gus,

    I tried to implement the solution in Outlook, but got stuck again. Is it only available in Outlook 2010?

  • Nope...It should be available for other Outlook versions as well, it might not be on the same place (I.E. In outlook 2007 there is a "View" menu instead of a tab in the ribbon as Outlook 2010) but you should have the ability to do it.

  • Gus.

    Conditional formatting is saved in the user settings..

    Search blogs regarding conditional formatting like blogs.msdn.com/.../microsoft-dynamics-crm-2011-let-s-get-conditional.aspx

    Apparentky you can even use conditional formatting on system views if you edit the grid from outlook.

    Rune Daub

    Senior CRM Business Consultant

    http://www.xrmmanagement.com

  • Rune,

    You say this works in the web client as well - I have created a formatted personal view in Outlook, when I view it in IE9 none of the formatting comes through. Also it says in the comments on your hyperlinked article users can only see the formatting if they use the Outlook Client.

    How have you made this work in IE?

  • Hey Andrew,

    The Conditional Formatting I show on the column applies only to Outlook...I think Rune is confused.

    Good to talk to you old friend! :)

  • Back to my original idea: attach some Javascript to a grid. Does anyone know what code gets called when grid is refreshed?

    Thanks.

  • Yeah.. Sorry.. I read a blog a while ago that stated that it was displayed in IE as well... And then I read the blog from Tripp Parker that stated you could use the conditional formatting on system views as well... Put two and two together and got the wrong result of 5..

    I should test blog info before i quote I guess :)

    Rune Daub

    Senior CRM Business Consultant

    http://www.xrmmanagement.com

  • I got it! This is the article that helped me:

    weblogs.asp.net/.../how-to-change-the-grid-icons-dynamically.aspx

    If anyone needs my solution, happy to share. Works beautifully. I hope next CRM version will support this feature.

  • Nice!

    That doesn't color code but it is enough to catch the eye! :)

    Thanks for sharing!