[TIPS] How to find the dirty fields in Dyanmics CRM form?

 [TIPS] How to find the dirty fields in Dyanmics CRM form?

Step 1: Click F12 on keyboard or CTRL+SHIFT+I

Step 2: in Console tab page, paste below script. All dirty fields are saved in changedAttributes array.


var formContext = Xrm.Page; //In V9, Xrm.Page is still available till.
var attributes = formContext.data.entity.attributes.get(); // Get all the attributes on the form

var changedAttributes = [];

for (var i in attributes) {
    var attribute = attributes[i];
    if (attribute.getIsDirty()) {
        changedAttributes.push(attribute.getName()); // Add the name of the attribute to the array of changed attributes
    }
}

console.log(changedAttributes);



No comments:

Post a Comment