Setting the crmForm or a Field to Dirty

CRM 4.0 does not allow you to change the IsDirty property of a field or the crmForm. These properties are calculated.
The way CRM calculates this value is by checking the fields DataValue against the fields defaultValue.

It might be nessecary to set the form to Dirty from an IFRAME or another source. To do this you could change the default value of one of the fields on the form.
In my case I always use the 2nd control on the form (which is actually the first field in all crmForms).

crmForm[1].defaultValue = “something nobody will ever enter in the field”;
(In my case I put a GUID in there)

NOTE: The defaultValue property is NOT documented in the SDK so I’m pretty sure this code is unsupported!

Tagged with: ,
Posted in CRM 4

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: