The default values for Boolean attributes or for picklist attributes are not used when you convert a lead to a contact, to an account, or to an opportunity in Microsoft Dynamics CRM 3.0 (920959)



The information in this article applies to:

  • Microsoft CRM 3.0

SYMPTOMS

Consider the following scenario in Microsoft Dynamics CRM 3.0. You customize the Contact form to provide default values for Boolean attributes or for picklist attributes when you create a new contact. Then, you convert a lead to a contact. In this scenario, the default values are not used when the contact is created.

Note This issue also applies to the Account form and to the Opportunity form when you convert a lead to an account or to an opportunity.

RESOLUTION

To resolve this issue, customize the OnLoad event of the Contact form, of the Account form, and of the Opportunity form to retain the default values when a lead is converted. To do this, follow these steps:
  1. Log on to the Web application of Microsoft Dynamics CRM 3.0.
  2. Click Settings, and then click Customization.
  3. Click Customize Entities.
  4. Double-click the entity that you want to customize. For example, double-click Contact.
  5. Click Forms and Views.
  6. Double-click Form. This is the main application form.
  7. Under Common Tasks, click Form Properties.
  8. On the Events tab, click OnLoad and then click Edit.
  9. On the Details tab, click to select the Event is enabled check box and then type the appropriate code.

    For example, if the new_defaultvalue attribute is a picklist attribute for which you want the default value to be the second element of the picklist, type the following code.
     
    var oField = crmForm.all.new_defaultvalue;
    // If no picklist item is selected on Form Load
    if(oField.DataValue==null)
    {
    // Set the picklist element to be the second element in the list.
    oField.DataValue=2;
    }
    crmForm.Save(); 
    
    If the new_defaultvalue attribute is a Boolean attribute for which you want the default value to be No, type the following code.
     
    var oField = crmForm.all.new_defaultvalue;
    // If there is no picklist item selected on Form Load
    if(oField.DataValue==null)
    {
    // Set the picklist element to be the second element in the list.
    oField.DataValue=false;
    }
    crmForm.Save(); 
    
  10. Click OK to close the Event OnLoad Properties dialog box.
  11. Click OK to close the Form Properties dialog box.
  12. Click Save and Close to close the Form: Contact dialog box.
  13. On the Actions menu, click Publish.
  14. Click Save and Close.
  15. Repeat step 4 through step 14 to customize the Account entity. Do the same to customize the Opportunity entity.

Modification Type:MinorLast Reviewed:8/28/2006
Keywords:kbMBScustomization kbProgramming kbtshoot kbMBSMigrate kbprb KB920959 kbAudEndUser