Change the colour of text in a field.

This question is not answered

Hi , 

In our company screen, I'm trying to figure out how to change the colors of the contents of  a RAG Status field we have (comp_rayg) based on the field data.  For instance, if a RAG status is set to  Green, I want the word "Green" to be Green, and if it's set to "Amber" I want the word "Amber" to be Amber  I've seen tips on how to change the colors of the actual title of the field using translations, but I can't figure out how to change the color of the contents.  I'm guessing it's a script, but I'm not sure of the code to use.

 

Can any one advise?

 

Thanks 

All Replies
  • Jenely

    This example should show you how to do this.  You would need to added the script to the Custom Content of the CompanyBoxLong screen.

    <script>

    crm.ready(function()

    {

    var fcomp_status = crm("comp_status").value();

    switch (fcomp_status)

    {

    case 'Active' :

    crm("comp_status").color('Green');

    break;

    case 'Archive' :

    crm("comp_status").color('Gray');

    break;

    case 'Closed' :

    crm("comp_status").color('Red');

    break;

    case 'Inactive' :

    crm("comp_status").color('Yellow');

    break;

    default :

    crm("comp_status").color('Black');

    }

    })

    </script>


  • That worked perfectly! Thank you very much

  • Apologies for coming back again! is there a way to amend the actual field titles to different colors? i tried to apply the same logic as the above code but i dont need to code to direct to a value such as comp_RAYG its the actual title.

    thanks

    jen