Every now and then, if your scripts are performing form changes, and you try to navigate without saving, you will be prompted to save. But what if you want to see exactly what was changed on a large form?

The following function can show you the modified fields:

function checkIsDirty()
{
    var _mesage = "";
    Xrm.Page.data.entity.attributes.forEach(
        function(attribute, index)
        {
            if(attribute.getIsDirty() == true)
            {
                message += attribute.getName() + "\n";
            }
        }
    );
    alert("These fields have been modified: \n" + message);
}

You could put this on a ribbon button, and allow the form user to check at any time what was changed since the last save. Alternatively, you could highlight the fields with a different background color rather than bring up an alert message.

Enjoy!

Advertisements