Introduction:
There may be times when you want to identify the fields that have been modified by the user in the current update.
While one way and the most common way has been to create a Plugin, the plugin only receives data of the fields that have been modified in the current update. If you wanted to check the previous value, you could compare the PreImage with the current value in the target and if they don’t match, it has been modified.
What if we had to identify the modified field through scripting?
It is common knowledge the form provides an IsDirty property that can be used to check if the form has been modified. We can check the form IsDirty using
Xrm.Page.data.entity.getIsDirty()
To get the list of attributes that have been modified in this session, you can check the IsDirty of the attribute. Here is a sample code of how you can loop through all the attributes and get the list of the modified attributes on the form
Another function that comes in handy here is
Xrm.Page.data.entity.getDataXml()
the result would be
Using the above function you can get a list of the data that is passed to the platform on update, and this inturn lists all the attributes that have been modified along with the current values being sent to the platform.
Conclusion:
Combination of getIsDirty on the form/attribute and getDataXml would help you quickly build a tracking tool without the need for a plugin.
Now do Accounting inside your Dynamics CRM, with InoLink – MS Dynamics CRM & Quickbooks Integration
There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementation, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!
The post Identify “Dirty” fields on Microsoft Dynamics CRM form appeared first on Inogic Blog.