Contact Us Now - Call us on

Microsoft Dynamics CRM

xRM

Resources

About Us

Find Us

 

Gap Consulting Microsoft Dynamics CRM Blog

How to add colour to a Microsoft CRM Form Picklist

I recently got asked by a customer to change the colours of Service Cases based on their priority.  P1 = Red, P2 = Yellow, and P3 = Green.  Whilst there is no standard capability within Microsoft CRM to perform this on Case Lists or Case Form, there is a form script which can be added to the Form OnLoad() to perform the change.

The colours are present within the picklist dropdown.

image

Upon selecting a value the picklist colour is then maintained on the form view.

image

The code required to make the above changes is as follows;

// Get the picklist
var picklist = crmForm.all.contractservicelevelcode;

// Change colour to Red if P1
var option = picklist.options[1];
option.style.backgroundColor = "#E55451";

// Change colour to Yellow if P2
var option = picklist.options[2];
option.style.backgroundColor = "#FFF380";

// Change colour to Green if P3
var option = picklist.options[3];
option.style.backgroundColor = "#5EFB6E";

 

Technorati Tags:

Print | posted on Wednesday, June 09, 2010 4:03 PM |

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 7 and 5 and type the answer here: