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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Filtered lookup based on total different entity

(0) ShareShare
ReportReport
Posted on by 76

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

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

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

  • Axi Bachlechner Profile Picture
    76 on at

    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
    vishal bagadia_crm Profile Picture
    490 on at

    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
    76 on at

    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

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans