Archive for December, 2007

How to change the entity drop down for the Customer Lookup

December 12, 2007 1 comment

In this post, I’m going to show you how to modify the entity drop down for the Customer Lookup without changing the security for the whole application.  

I’m going to use the customer lookup for opportunity as our example.   By default you have Account and Contact in the drop down for the ‘Look For:’ search criteria.


If you look at the html for the customer lookup field, on the opportunity form, it looks like this.

<img src="/_imgs/btn_off_lookup.gif" id="customerid" class="lu" tabindex="1010" lookuptypes="1,2" lookuptypenames="account:1,contact:2" lookuptypeIcons="/_imgs/ico_16_1.gif:/_imgs/ico_16_2.gif" lookupclass="BasicCustomer" lookupbrowse="0" lookupstyle="single" defaulttype="0" req="2">

The 3 attributes we will need to change is lookuptypes,lookuptypeNames and lookuptypeIcons.

Reorder the Dropdown

To reorder the drop down, add the following code to the ‘OnLoad’ of the Opportunity form.

crmForm.all.customerid.lookuptypes = "2,1"
crmForm.all.customerid.lookuptypenames = "contact:2,account:1"
crmForm.all.customerid.lookuptypeIcons = "/_imgs/ico_16_2.gif:/_imgs/ico_16_1.gif"

The dropdown should default to Contact when it’s opened.


Remove an Entity from Dropdown

To remove Contact from the customer lookup for Opportunity add the following code on the ‘OnLoad’ of opportunity.

crmForm.all.customerid.lookuptypes = "1"
crmForm.all.customerid.lookuptypenames = "account:1"
crmForm.all.customerid.lookuptypeIcons = "/_imgs/ico_16_1.gif"

The lookup should only be for accounts.


Although it may be possible, I wouldn’t add entities to the lookups since the customer relationship does not exist.


This customization may not be supported by Microsoft and is provided as-is with no warranty.

Categories: Uncategorized