Cry about...
Dynamics CRM 2016


Which fields are dirty?


Have you ever needed to know which fields are dirty? i.e. which fields have had their values changed and thus need to be saved. Microsoft Dynamics CRM provides you with a few methods you can use to get this information.

Is the page dirty?

The simplest way of determining whether a page is dirty is to use the JavaScript:

Xrm.Page.data.entity.getIsDirty()

This will return true if the page is dirty, false otherwise.

Is an attribute dirty?

You can also use JavaScript to query the is-dirty status of each field:

Xrm.Page.getAttribute('logical-field-name').getIsDirty()

which will return true if the field is dirty, false otherwise.

List dirty fields in the debugger

If you are using the integrated debugger (F12 when running IE or Edge) then you can add a watch expression to show you the dirty fields. Simply add the following as a watch expression:

Xrm.Page.data.entity.getDataXml()

This returns Xml. The outer tags of the xml contains the logical entity name. Any inner elements reflect those fields that are dirty.

Using this you can step into JavaScript functions and see how the list of dirty fields changes.


These notes have been tested with Microsoft Dynamics CRM 2016, and may apply to other versions as well.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.