web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Filter Customer field on Case Form

(0) ShareShare
ReportReport
Posted on by

Hi,

In the Customer Field of the Case Card Form, I'd like our users to only be able to choose Accounts (not Contacts) with Relationship Type = "Customer" (so not Leads, Prospects, etc.)
Is there a way to do this?

Kind regards,


Nina

*This post is locked for comments

I have the same question (0)
  • Verified answer
    ajyendra Profile Picture
    1,738 on at

    Hi ,

    Please Refer that Link:

    https://www.powerobjects.com/blog/2015/11/20/restrict-customer-lookup-to-accounts-or-contacts-in-dynamics-crm/

    Hope it helps

    Thanks

    Ajyendra

    If this answer is helpful to you . Please Mark as Verified.

  • Community Member Profile Picture
    on at

    Hi Ajyendra,

    Thanks a lot, that answers the first half of my question.

    However, I still do not know how to filter on a field (in my case the custom field Relationship Type) of a field (Customer). Would you have an example of the code for this as well?

    Kind regards,

    Nina

  • Verified answer
    ajyendra Profile Picture
    1,738 on at

    Hi,

    Instead having 2 filters , add to it respective custom filter.

    Change condition and field name as per your need.

    var contactFilter = "<filter type='and'><condition attribute='customertypecode' operator='eq' value='1' /></filter>";
    var accountFilter = "<filter type='and'><condition attribute='accountid' operator='not-null' /></filter>";
    
    Xrm.Page.getControl("customerlookupfield").addCustomFilter(contactFilter, "contact");
    Xrm.Page.getControl("customerlookupfield").addCustomFilter(accountFilter, "account");

    Thanks
    Ajyendra

    if this answer is helpful to you. Please Mark as Verified.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans