Friday, May 18, 2012

MS CRM 4.0 Picklist Changes Not Saving (and on purpose)

Posted in [Dynamics CRM], [Technical] By Michael Thompson @ 3/12/2009 1:39 PM

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;

Comments

Got something to say? Join the discussion »

leave a reply

 [Quick Submit with Ctrl+Enter]

Remember my details
Notify me of followup comments via e-mail

C5_Insight

About C5 Insight

We are a Microsoft Gold Certified partner focusing on SharePoint, Microsoft Dynamics CRM and Salesforce.com.  Learn more about us by visiting our website.

Search

We Wrote the Bible on Microsoft SharePoint and Dynamics CRMBook-Microsoft Dynamics CRM 2011 and SharePoint 2010 Bible

Tags

Maximize

Recent Comments

Maximize

Blog Roll

Maximize

Disclaimer

The information herein may be used solely at your own risk.  No warranty is made by the author or by C5 Insight, Inc.

The opinons expressed herein are those of the individual authors and do not necessarily represent C5 Insight, Inc in any way.

Copyright 2011 by C5 Insight