Always had this issue...Finding which field is Dirty
When we are developing some functionality, we are frequently hit with the IE's save alert box. This dialog box shows up when any of the field is actually dirty (in the sense, its value is modified).
IE Save Alert |
The below function will help in finding the dirty fields. All you need to do is call this function whenever and wherever required.
Code to throw dirty fields
function ThrowDirtyFields() {
var ctrlName
= Xrm.Page.ui.controls.get();
for (var i in ctrlName)
{
var ctrl = ctrlName[i];
if (ctrl.getControlType() != 'subgrid' &&
ctrl.getControlType() != 'notes' && typeof ctrl.getAttribute() ! = 'unknown' && typeof ctrl.getAttribute() != 'undefined') {
var isDirty = ctrl.getAttribute().getIsDirty();
if ((isDirty != null)
&& (isDirty == true))
alert(ctrl.getName());
}
}
}
Hope it helps. !! :) Happy Coding!!