Daren's profileDaren TurnerBlogLists Tools Help

Blog


    December 12

    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.

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    No namewrote:
    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.
    Oct. 12

    Trackbacks

    The trackback URL for this entry is:
    http://dtu11.spaces.live.com/blog/cns!D01B965C27CB1CC6!161.trak
    Weblogs that reference this entry
    • None