Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Filter N:N Look-up in BPF

Posted on by Microsoft Employee

Hello fellow CRM developers

I like the new filtered lookup feature in the new version of CRM. I use it to have one lookup filter another lookup. But it doesn't work in the BPF (business process flow). This is a known issue but there's a workaround. For a 1:N/N:1, this can easily be achieved with a filter eventhandler applied via javascript like this:

    if (Xrm.Page.getControl("header_process_new_product") != null) {
        Xrm.Page.getControl("header_process_new_product").addPreSearch(addFilterProductHeader);
    }

function addFilterProductHeader() {
    var filter = " <filter type='and'>";
    filter += " <condition attribute='new_casetype' operator='eq' value='id_of_filtering_field' />";
    filter += " </filter>";
    Xrm.Page.getControl("header_process_new_product").addCustomFilter(filter);
}

However this doesn't work for a N:N relationship. A lookup that filters another lookup (and the relationship between the two entities is N:N not 1:N).

Example:
I have many "Case Products" which can have many "Case Solutions", and vice versa. A N:N in other words. I can use the new filtered lookup option on form, but not in the BPF.

Is there any workaround for this?

*This post is locked for comments

  • Suggested answer
    Marcel Lathouwers Profile Picture
    Marcel Lathouwers 168 on at
    RE: Filter N:N Look-up in BPF

    Hi erkula,

    not sure if you get this to work in the bpf. 
    you could consider to let the user fill in these fields on the form in stead of the bpf and on the bpf have two check mark fields to confirm that this information was given.

  • vishal bagadia_crm Profile Picture
    vishal bagadia_crm 490 on at
    RE: Filter N:N Look-up in BPF

    Hello Erik..

    Have you found any solution for this... I also have the same issue.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Filter N:N Look-up in BPF

    To be clear: This has nothing to do with subgrids. Just two lookups on the Case entity with a N:N with each other and I want one of them to filter the other (in the BPF -- where standard filter doesn't work).

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Filter N:N Look-up in BPF

    Thank you for your reply Mohd Saad Akhtar but those are subgrid lookups and not regular lookups.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Filter N:N Look-up in BPF

    www.magnetismsolutions.com/.../filter-n-n-add-existing-lookup-dynamics-crm-2016-turbo-forms

    http://missdynamicscrm.blogspot.sg/2016/05/filter-n-to-n-many-to-many-subgrid-lookup-existing-record-form-script.html

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans