Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Remove contact relationship from Customer lookup field

(0) ShareShare
ReportReport
Posted on by

Hi experts, 

In the case record, there is an out of the box system required field called "Customer" 

Screen-Shot-2018_2D00_03_2D00_26-at-1.04.44-PM.png

When we select the lookup field we can choose both contacts and accounts. However I don't want the lookup to search for contacts. How can I remove this and have the field exclusively search for accounts?

Screen-Shot-2018_2D00_03_2D00_26-at-1.05.02-PM.png

Thanks,

Jon

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Remove contact relationship from Customer lookup field

    Hi Rawish,

    That worked.

    Thanks so much!

    Jon

  • Verified answer
    Rawish Kumar Profile Picture
    13,758 on at
    RE: Remove contact relationship from Customer lookup field

    Hi Jon,

    Its to do with the Apostrophes , use below:

    function defaultcustomer(){

       Xrm.Page.getControl("customerid").addPreSearch(addFilter);

    }

    function addFilter()

    {

       var customerAccountFilter = "<filter type='and'><condition attribute='contactid' operator='null' /></filter>";

    Xrm.Page.getControl("customerid").addCustomFilter(customerAccountFilter, "contact");

    }

    call this function on change on change event of customer field.

  • Community Member Profile Picture
    on at
    RE: Remove contact relationship from Customer lookup field

    Hi Rawish,

    Please find below the syntax screenshot:

    Screen-Shot-2018_2D00_03_2D00_26-at-1.51.25-PM.png

    Thanks,

    Jon

  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at
    RE: Remove contact relationship from Customer lookup field

    Hi Jon,

    Looks like some syntax error. Kindly post the screenshot of the script. Make sure all braces are properly opened and closed.

  • Community Member Profile Picture
    on at
    RE: Remove contact relationship from Customer lookup field

    Hi Rawish,

    Thanks for your reply.

    I followed the link you provided however, I'm getting the following error:

    Screen-Shot-2018_2D00_03_2D00_26-at-1.37.43-PM.png

    Thanks,

    Jon

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Remove contact relationship from Customer lookup field

    Hi Jon,

    There is no standard configuration to remove the contact reference from the customer field. You can however create a new field (lookup to account) and use this field instead of customer. You can then have a real time workflow to copy the value from this field to the customer field just to ensure the references to other related entities.

    If you still want to use the customer field then the above suggested option should work for you.

    Hope this helps

  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at
    RE: Remove contact relationship from Customer lookup field

    Hi Jon,

    If its really needed you can create a simple javascript using preSearch function where you will get only accounts or contacts.

    refer below:

    www.powerobjects.com/.../restrict-customer-lookup-to-accounts-or-contacts-in-dynamics-crm

    I hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans