Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Show all elements based on a filtered lookup

Posted on by 65

Hi everyone.

I have a js code to create a filtered lookup and it is working well:
It's just a pre filter to show only entities "associated with the actual BPF step:

...
Xrm.Page.getControl("header_process_mypfx_salesstatus").addPreSearch(function () { fetchXml = "<filter type='and'><condition attribute='mypfx_relatedentity' operator='eq' value='" + entityName + "' /><condition attribute='mypfx_stepname' operator='eq' value='" + stepName + "' /></filter>"; Xrm.Page.getControl("header_process_mypfx_salesstatus").addCustomFilter(fetchXml); });
...

I have to change this to always show all possible options for this "mypfx_salesstatus" entity, even when a value is already selected. For example:

If there's no values at the lookup field, it's working fine:

ok.png

But, after select one value and search for another value only one option appears:

notok.png

it seams to have a "default filter" to look for entities where its name contains part of the string inside the lookup box and, only after that, it insert my custom filter.

How can i do that?

Thanks

*This post is locked for comments

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Show all elements based on a filtered lookup

    Unfortunately there is no setting in CRM to make lookup work way you want...

  • Feminho Diniz Profile Picture
    Feminho Diniz 65 on at
    RE: Show all elements based on a filtered lookup

    There's no way to always show all elements that i want?

    Thanks!

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Show all elements based on a filtered lookup

    Hello,

    This is how oob lookup prefiltering works not only in header fields but in form fields as well.

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