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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Filter Contact Lookup Field Based on Account Lookup Field

(0) ShareShare
ReportReport
Posted on by

Within an opp form I have two Account lookup fields (Bill To and End Client) and two Contact lookup fields (Bill To Contact and End Client Contact).  When a user goes to select the relevant contacts I want to limit the options they can choose from, only presenting them with the option to save Contacts that relate to their corresponding Account.  I believe related records filtering is the way to go, just not sure how to set appropriately.  Below is the part of the opp form that corresponds to these fields.  Any help would be appreciated. 

7384.FIltering.png

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at
  • Verified answer
    Ryan Maclean Profile Picture
    3,070 on at

    Hi Eden,

    This is really straightforward, and shouldn't require any code.  If you open the Field Properties for the Contact fields on your form (i.e. by double-clicking on them, or by highlighting them then clicking "Change Properties" on the ribbon), you can edit them by scrolling down to the "Related Records Filtering" on the Display tab of the properties modal.

    In the related records filtering section, tick the box that says "only show records where" then select "Account in the first selector" and then "Company Name" in the second selector

    Contact-Field-Filtering_2800_1_2900_.PNG

  • Community Member Profile Picture
    on at

    Hi Ryan,

    Thanks, that helped clarify some confusion, but I'm left with some more in its place.  I followed your instructions for the End Client Contact field and configured it as below, which works great

    account_2D00_difference.png

    However, when I go to do it the Bill To Contact field which is being drawn off the Customer field (labelled as Bill To), it's not working.  I go to select Customer (Accounts) (Opportunities) as shown below and again choose Company Name (Accounts) (Contacts) as I did for End Clients.

    customer_2D00_issue.PNG

    However, when I do that I get the Query Builder Error below

    query_2D00_error.png

    I'm not sure if it's because the Customer (again, labelled as Bill To) field is special in some way.  If you look in the image below, I've selected the same account for Bill To and End Client, yet the Bill To (again, technically Customer field) has some icon next to it.  Again, any help would be appreciated.

    account_2D00_difference.png

    asd

  • Community Member Profile Picture
    on at

    After some research I've identified that the Bill To field is of type "Customer", which may be why there is that icon and likely to be why I can't restrict the Bill To Contact field.  

    Mahadeo's link to www.powerobjects.com/.../restrict-customer-lookup-to-accounts-or-contacts-in-dynamics-crm is actually relevant now, but not sure how to add the javascript to the form, doesn't seem to be working.  Might see if someone more technical in my company can help.

  • Suggested answer
    Ryan Maclean Profile Picture
    3,070 on at

    Hi Eden,

    You are correct that it is because the Bill To field is of Type "Customer".  The Icon shows that the selected "Customer" is a Contact type, and this will cause conflicts when you try and restrict the Bill To Contact.  You could create a new "Bill To" field and make it a Lookup to Account, then use this to filter the Bill To Contact field.  You could then use a real-time workflow to populate your existing Bill To field with the Bill To Account.

    This would save you needing to use any javascript

  • Community Member Profile Picture
    on at

    Hi Ryan, I was wondering, if one of my fields is in my business process flow, can I still do this ? I am trying to figure out how and I cant seem to do it. I cant find the ''Field properties'' box unless the field is in my form. If it is in my process I cant.. Help :(

  • Ryan Maclean Profile Picture
    3,070 on at

    Hi egcoons,

    If you have the field in your BPF, then you could add it to your form in a hidden tab to apply the filter, and this should correlate to the field in the BPF

  • Sumedha Obeysekera Profile Picture
    307 on at

    Handling of Customer Type Lookups explained here; sumedha8.blogspot.com.au/.../filtered-lookup-for-customer-type-fields.html

  • AnnFear Profile Picture
    40 on at

    Hi Ryan, I'm trying to achieve this within the Case entity and both my Customer (Account) and Contact fields are in the BPF. The Contact field on the form is filtering to only contacts linked to the Account but the Contact field within the BPF isn't - any ideas? Thanks,

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans