Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Filtered lookup based on total different entity

(0) ShareShare
ReportReport
Posted on by 72

Hi!

I found many posts about filtering a lookup but none of them fullfilled my needs.

I have three Entities outcome, result and reason.

I have created one Entity which acts as matrix and which has one lookup to each of the entities mentioned before.

So the matrix would look like this (grid with outcome, result and reason):

a b c
a bb c
aa bb c
aa bbb cc

On another entity I have also three lookups one for each entity.

What I want to achieve is: if I select in outcome-lookup the value a I only want to show in result-lookup value b and bb, but not bbb

If I select aa the result-lookup should show bb and bbb but not b.

I've created a view on result, based on related entity matrix where outcome-id eq 'xx'

My filter looks like this:

var outComeCode = Xrm.Page.getAttribute('new_outcomeid').getValue();

var fetchXml = '<filter type="and"><condition attribute="new_outcome" operator="eq" uitype="new_outComeCode" value="' + outComeCode[0].id + '" /></filter>';

var LookupControl = Xrm.Page.getControl("new_resultcode");
if (LookupControl != null) {
LookupControl.addPreSearch(function () {
LookupControl.addCustomFilter(fetchXml);
});
}

but new_outcome is only a attribute of the matrix but not of my result-entity

How can I filter this?

I hope my question is clear and also I hope for a clear and helpful answer

thx

©a-x-i

  • Axi Bachlechner Profile Picture
    Axi Bachlechner 72 on at
    RE: Filtered lookup based on total different entity

    Thank you for your post! I think I forgot to mention one important point: it's no 1:n relationship but a n:n relationship

    So there is a possible combination like this (outcome - result - reason)

    outome A - result A - reason A

    outcome B - result A - reason A

    In the country - state - city relation this wouldn't be possible.

    But thx again for your very good link!

    ©a-x-i

  • Suggested answer
    vishal bagadia_crm Profile Picture
    vishal bagadia_crm 490 on at
    RE: Filtered lookup based on total different entity

    Hello Axi,

    I understood your scenario.

    Correct me if I am wrong.. It basically in common terms similar to Country State and City..

    If I choose Country, State should get filtered based on selected country.

    Once I select State, city should get filtered based on selected state.

    And this lookup is available in some entity.. may be for example- Address Entity.(Matrix in your case)

    This lookup filtering is definitely possible, if you create proper relationships between your entity.

    I am attaching some blogs for you to achieve your requirement.

    community.dynamics.com/.../filter-country-state-city-lookups-in-crm

    www.abtosoftware.com/.../how-to-create-cascading-lookup-in-microsoft-dynamics-crm

    Please go through the blogs and if it helps you in solving your purpose, please mark the answer as verified.

    Regards,

    CRM Developer

  • Axi Bachlechner Profile Picture
    Axi Bachlechner 72 on at
    RE: Filtered lookup based on total different entity

    I try to.... 

    I have three entities. outcome, result and reason

    I have a firth entitity which has a lookup for outcome, result and reason.

    The problem to solve: the lookup for result depends on the selected outcome and subsequently reason depends on the selected outcome and result.

    So I created an additional entity with lookup for outcome, result and reason. This entity works as matrix to show which combinations of outcome, result and reason are possible.

    I thought I can use this 'matrix' for the filter in the lookup. But damn, it isn't possible

    Do you understand the scenario with the new explanation?

    thx

    ©a-x-i

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Filtered lookup based on total different entity

    Hello,

    I would love to help but I don't understand your scenario. Can you please elaborate?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans