You can use the following code for your reference
var attribs = Xrm.Page.data.entity.attributes.get();
to get the list of all fields in the from and then call the function getIsDirty()
for it as
var filterDirty = attribs.filter(function(elem,index,attribs){
var name = elem.getName();
return (Xrm.Page.getAttribute(name).getIsDirty() === true);
});
Now the filterDirty
will hold an array of all the dirty fields and you can just print it with the map as
filterDirty.map(function(e){ console.log(e.getName()); });
Note: Just make sure Xrm is available you can see why there is additional bit of code before the what i described above from here
the whole code will look something like this for you
// get the correct frame
for(var i=0;i<5;i++) //loop through 0 to 4
if(frames[i].Xrm.Page.ui != undefined) //check if undefined
{
Xrm = frames[i].Xrm; //assign Xrm
console.info("~: Xrm updated with frame " + i + " :~"); //show info
break; //breakout the loop
}
//Query
var attribs = Xrm.Page.data.entity.attributes.get();
//Filter
var filterDirty = attribs.filter(function(elem,index,attribs){
var name = elem.getName();
return (Xrm.Page.getAttribute(name).getIsDirty() === true);
});
//print
filterDirty.map(function(e){
console.log(e.getName());
});