Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Accessing lookup Values.

Posted on by 795

Hello,

I have a requirement that i have two entities  A and B. Let say A contains name (text field) and B contains a field which has a lookup to A entity.

Now, i have a third entity which has two fields (both lookup fields) .Now , if i select name in one lookup ,then the lookup of other field gets filtered based on this.

How can i achieve this?

Thanks for any help!

*This post is locked for comments

  • CRM Beginner  Profile Picture
    CRM Beginner 795 on at
    RE: Accessing lookup Values.

    Thanx Mam..I am done with it..

  • CRM Beginner  Profile Picture
    CRM Beginner 795 on at
    RE: Accessing lookup Values.

    Mam,i am not getting Configurable properties for a field

  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Accessing lookup Values.

    Here is a short version:

    - Open lookup control properties for "Field 3" on the form

    - Find "Related Records Filtering" section

    - Set up "only show records" correctly (to match Field 2)

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Accessing lookup Values.

    Come on.. read that article.. we sent you the link twice:))

    If it does not apply to your scenario, please explain why.

  • CRM Beginner  Profile Picture
    CRM Beginner 795 on at
    RE: Accessing lookup Values.

    But i want filtered data in Field 3 based on Field 2 ..Can i?

  • chauhanhardik Profile Picture
    chauhanhardik 685 on at
    RE: Accessing lookup Values.

    Hi Alexa,

    If there is a requirement as you described he/she has to use dependent lookup method

    for that he/she can refer this link:

    www.powerobjects.com/.../how-to-use-dependent-lookups-for-dynamics-crm-201320152016

    Thanks,

    Harry

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Accessing lookup Values.

    Yes, but why using OData etc if you can simply go to the configuration screen for Field 3, set up the lookup field, and it'll work just like that?

  • CRM Beginner  Profile Picture
    CRM Beginner 795 on at
    RE: Accessing lookup Values.

    Exactly , same scenario i have..and i have solved it and have the filtered data in an array using OData query..Just want help how to set that array to lookup field

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Accessing lookup Values.

    If you have this:

    Entity A:

     Name

    Entity B

      Field1:  Lookup to A

    Entity C:

      Field 2: Lookup to A

      Field 3: Lookup to B

    You can configure Field 3 lookup on the entity C form to display only those records which are referencing the same A which is selected into Field 2 (and you just need to follow the steps described in that article by PowerObjects)

    Question is, if that's what you have..

  • Suggested answer
    chauhanhardik Profile Picture
    chauhanhardik 685 on at
    RE: Accessing lookup Values.

    Hello,

    replace "new_linkedaccount" with schema name of your field

    function preFilterLookup() {

    debugger;

       Xrm.Page.getControl("new_linkedaccount").addPreSearch(function () {

           addLookupFilter();

       });

    }

    function addLookupFilter() {

       var fetchXml = '<filter type="and"><condition attribute="industrycode" value="8" operator="eq"/></filter>';

       Xrm.Page.getControl("new_linkedaccount").addCustomFilter(fetchXml);

    }

    here in the fetchxml "industrycode" is lookup field based on what you get filtered data

    Thanks,

    Harry

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans