Default Customer Lookup to Contact in CRM 2011
January 13, 2011 47 Comments
There has been a slight change in the way you default the Customer Lookup field to Contact in CRM 2011 compared with CRM 4.
Use the following code to set the Customer Lookup to Contact instead of Account and set the default view.
document.getElementById("customerid").setAttribute("defaulttype", "2"); Xrm.Page.getControl("customerid").setDefaultView("a2d479c5-53e3-4c69-addd-802327e67a0d");
The first line sets the default entity type to Contact for the Customer Lookup dialog.
The second line sets the Customer Lookup dialog’s view to the ‘Contacts Lookup View’ using its guid value. If you do not use this line of code it will default to the ‘My Active Contacts View’ or whatever you have selected as the default Contact view.