This is very much unsupported and can be completely useless if Microsoft decide to change ID/Class names in CRM. There are a lot better ways to do this (http://mscrmshop.blogspot.co.uk/2012/07/how-to-change-form-header-colour-based.html) but this is just a quick and dirty way to change content colours with JS. Example below is changing the case form header background color based on a dropdown option, all in JavaScript.

headercontent

 

  • Open / Create javascript web resource
  • Attach the following code to the web resource (Below)
  • Add the function to the priority on-change and to form onload (Call the function in an existing onload)
  • save and publish
function onchange_priorityCSS()<br />
{</p>
<p>//get the text value picklist field<br />
var relType = Xrm.Page.getAttribute("prioritycode").getText();<br />
switch (relType) {<br />
case "1 - Business Criticial":<br />
//The ID is taken from Internet Explorers developer tools<br />
document.getElementById("crmFormHeaderTop").style.backgroundColor = "red";<br />
break;<br />
}</p>
<p>}

Example of OnLoad:

function onload(){</p>
<p>statusReason();<br />
trackSLA();<br />
onchange_priorityCSS();<br />
}<br />
}

Once you’ve done this, if the case priority is 1, the header will change to a ghastly red and be red when it’s re-opened.

January 28, 2014

Dynamics CRM 2011 – Form CSS with JavaScript

This is very much unsupported and can be completely useless if Microsoft decide to change ID/Class names in CRM. There are a lot better ways to […]
January 27, 2014

Error registering plugins and/or workflows. Action failed for assembly ”: Assembly must be registered in isolation.

Issue: Using the CRM 2011 Development Toolkit and deploying a plugin you get the following error (Example): Error 36 Error registering plugins and/or workflows. Action failed for […]
January 22, 2014

Dynamics CRM 2011 – Retrieve attribute value using oData

  Issue: Have a custom lookup field looking up the contact entity and need to pull specific information (email address) from the contact entity into a […]
January 21, 2014

Dynamics CRM 2011 – C# Template (Note to self)

Note to self. Add: After:    
January 16, 2014

Dynamics CRM 2011 – Replace case resolution with dialog

NOTE: There are probably better ways of doing this (e.g.  a ribbon editor) Problem: CRM case resolution doesn’t allow customisation Solution: Replace case resolution with custom […]
January 13, 2014

Dynamics CRM 2013 – Change navigation area icon

Image Size: 32×32 (By the looks of it – I did 24×24 to test, as below, but is a bit smaller, so 32×32 seems logical) Image […]
January 13, 2014

CRM 2013 – Create quick create form and add to navigation

Spent far too long looking for this, wanted to throw myself out of the window.. Customise the System Select entity (e.g. Accounts) Scroll down to ‘Allow […]
January 10, 2014

Dynamics CRM 2013 – Another Gripe… Advanced Find from Settings

Where in the world do I run an advanced find from on CRM 2013 when in Administration? (or likewise) CRM 2011: CRM 2013:   Either I’m […]
January 8, 2014

Dynamics CRM – Goals or Reporting?

One thing I’ve learnt whilst living in the world of Dynamics CRM is that KPIs are nice. They can be used for both good and evil. […]
January 8, 2014

CRM 2013 – Home Button Love

I know this is probably the smallest change in the world, however in my mind it’s so much nicer than it was in 2011. The bit […]