Home > Uncategorized > How to change the entity drop down for the Customer Lookup

How to change the entity drop down for the Customer Lookup

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
  1. Unknown
    October 13, 2009 at 12:11 am

    Hi, i don\’t know where to get such attributes for lookup field name like "lookuptypes ","lookuptypenames ","lookuptypeIcons ". Once i changed them, MSCRM didn\’t work normally.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: