Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Filter lookup on account or parent account

Posted on by 1,540

Dynamics CRM V9 Online

Lets say we have a hierarchy in accounts:

"Microsoft HQ" is the parent with "Microsoft USA" and "Microsoft UK" as child accounts, each with their own set of contacts.

When a case is created I have a custom lookup field to account and contact.

If the case is for Microsoft HQ, the contacts are filtered correctly to those linked to Microsoft HQ using the OOB filtering on the form.

If the case is against one of the child accounts Microsoft UK, I want the list of contacts to include those from the parent, so a combined list of contacts from Microsoft HQ and Microsoft UK.

I have tried creating a second lookup field on contact to parent account and have this being updated via workflow and plugin so it cascades down. However then my lookup to contact on case would need to check two lookup fields on contact (contacts where parentaccountid = "Microsoft HQ" or new_parents_parentaccount = "Microsoft HQ")

Is this possible using some javascript?

*This post is locked for comments

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Filter lookup on account or parent account

    Hi Chris,

    Out of box Record filtering works based on the parent lookup field so you won't be able to get the desired records.. This can be achieved by custom JavaScript. Basically you need to first find if the account is child or parent, if child then get the reference of the parent accounts.

    Once you have all the account, you then need to apply custom field for the contact lookup i.e. all contacts where account is in that list.

    Refer thsi for custom filer-

    www.inogic.com/.../apply-custom-filter-on-lookup-field-in-dynamic-crm-using-script

    To get the references of the parent account, you can use rest builder tool to build  the qeb api query-

    www.toplinestrategies.com/.../crm-rest-builder-useful-tool-working-crm-2016’s-web-api

    Download tool from here: github.com/.../releases

    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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans