CRM 2011 Checking for changed fields in a form

Sometimes, when trying to close a form down in Dynamics, or trying to print preview, you will often get the following message.

isDirty

This will nearly always mean that when the form has loaded, some of the attributes have actually changed, so Dynamics detects that the form is not up to date, and requires a save before proceeding.

This can sometimes be tricky to work out what has changed, so below is a useful little trick.

In Internet Explorer, hit the F12 key when the form is displayed, and select the script tag.  Copy and paste the following code in to the script input area and run it.  This should then print out the name of all of your “Dirty” fields.

var listOfAttributes = frames[0].Xrm.Page.getAttribute();
for(var attrib in listOfAttributes){
   var currentAttrib = listOfAttributes[attrib];
   if (currentAttrib.getIsDirty && currentAttrib.getIsDirty()){
     console.log(currentAttrib.getName());
   }
}

CRM 2011 Web Resource Linker / Publisher

This is an excellent utility for visual studio 2012 (and 2010 with a bit of tinkering) that allows you to publish JavaScript and other web resources straight from Visual Studio. It’s a huge time saver and seems to be pretty reliable. It’s an essential part of my workflow now.

http://webresourcelinker.codeplex.com

Depending on the version of Visual Studio you use, all you need to do is edit the WebResourceLinker.AddIn file, and change the Version element of the XML to one of the following :

Visual Studio 2010

<Version>10.0</Version>

Visual Studio 2012

<Version>11.0</Version>

Visual Studio 2013

<Version>12.0</Version>

After that, just copy the contents to your Visual Studio 201x\Addins folder for it to work.

You may also need to manualy unblock each DLL in the addin folder as well to get it to work.

Entity Documentation Generator

A useful utility that should always be used to document your entities when developing them is the Metadata Document Generator.  With this, you can point it at your Dynamics Install and have it produce documents outlining your custom entities, and their fields and relationships.  This is always useful to have on hand when developing, or reporting on your data.

http://metadatadocgenerator.codeplex.com/releases/view/94885