Doing CSS the right way with Dynamics CRM

One of a few practices I see when people customize Dynamics CRM that usually comes back to haunt them during update rollups or upgrades is directly referencing the CSS files and classes that come with the product.  It’s an innocent enough mistake, but the CSS files which ship with Dynamics CRM are intentionally not documented in the SDK.  Directly referencing them is not supported.  The Dynamics CRM team reserves the right to change them at any point, just like they reserve the right to change the structure of their html.  That’s why direct HTML DOM manipulation of the UI the server creates isn’t supported either.  Of course, you can manipulate the DOM of the web resources you author as much as you like.  If you think about it, this makes perfect sense.  I am not aware of any product out there that shield you from future changes if you hardcode your extensibility code to html/css structures.  So what should you do?  Well, you should create your own CSS files which mimic the CRM look and feel and reference those from your web resources.  That way, when anything changes with the Dynamics CRM codebase, you are shielded from any ripple effect.  You’re customizations may look out of place if major colors or fonts change.  However, if you structure your CSS right (i.e. don’t copy paste, reuse), then you should be able to adjust to those changes with less impact.  Ok, but how?  Here’s a great article from the Dynamics CRM in the Field blog which walks you through the fundamentals:

http://blogs.msdn.com/b/crminthefield/archive/2014/07/03/css-style-reference-using-developer-tools.aspx

@devkeydet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s