In MS CRM 4.0 any field changes made that are enabled will be save.  Lets say on the Account form you have a picklist that will display the following in an IFrame.

  • Map to Account Address
  • Accounts Web-page
  • Primary Contact Information
  • Page to ERP showing Credit Stats.

When you change the CRM picklist controlling the IFrame CRM will change to IsDirty (asking you to save or not on exit).  You really probably don't want to allow of force the user to save every time they look at the account.

Options are to set the picklist back to original value which takes a few lines of code and attaching to the OnSave or Close event.  Too much coding.

Easy answer ahead.  Looking in CRM through debugger and IE toolbar there is a field value that CRM is monitoring to determine if the picklist has changed.  If we set the currently selected to that value CRM will not save the field as it is back to the original value.  As I said I don't want the user changing this field to the database so I found a way around it.  Since you can access IsDirty to set the value to dirty and form but cannot set it to false. here is the answer.

Behind the picklist OnChange event:

crmForm.all.[yourpicklistname].defaultSelected = crmForm.all.[yourpicklistname].DataValue;

Now no matter what the user selects on exit of the account form the OnChange or Close will not look at the picklist as it thinks it has not changed.

**Note if the field is new to the form setting default value will still leave records created before field to bring picklist with null value.  OnLoad you will probably want to set the default picklist value to the first entry or set it by different parameters depending on account values such as Pass Due or Credit Card expired.


Behind the Account OnLoad event:

crmForm.all.[yourpicklistname].DataValue = 1;