Check if any field on a D365 CE/CRM form is dirty

This function will return an array of fields which are currently modified by not saved on a form in Dynamics 365 CE/CRM

function CheckDirtyFieldsOnForm(executionContext)
    formContext = executionContext.getFormContext();
    var attributes =;
    var dirtyAttributes = [];
    if (attributes != null) {
        for (var i in attributes) {
            if (attributes[i].getIsDirty()) {
    return dirtyAttributes;

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.