Best way to find dirty fields – XrmMtl Skip to content

Best way to find dirty fields

Hi folks,

Wondering what is that nasty field that kepts getting dirty when you open a form? Search no more and use:

Xrm.Page.data.entity.getDataXml();

It returns the data that will be send once you save the page.

"<account><primarycontactid type="2" name="Nick">646a9377-f184-e611-80c9-0050569307c5</primarycontactid></account>"

So, instead of looping through all fields and checking for who’s dirty. Do an indexOf on it:

Xrm.Page.data.entity.getDataXml().indexOf('<primarycontactid');

Published inUncategorized