Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : uNFPRAp7Eii0jhK4HIMKBc
Microsoft Dynamics CRM (Archived)

multiple level of expansion in webapi

Like (0) ShareShare
ReportReport
Posted on 20 Apr 2016 07:03:53 by 347

I have an entity called as medicalcase

Each medical case has a subgrid, N:N relationship with an entity called as mcfamily

Each mcfamily has Father, Mother, Child fields which are lookups to contact field

Now if I make a webapi call 

http://serverurl/api/data/v8.0/new_medicalcase(caseid)?expand=new_medcase_mcfamily

I get the new_father_value, but I want to expand the Father lookup and get the contact name. How can I do it?

I tried

http://serverurl/api/data/v8.0/new_medicalcase(caseid)?expand=new_medcase_mcfamily($expand=new_father($select=fullname))

But it said 

navigation property can't be expanded. Multiple levels of expansion aren't supported.

*This post is locked for comments

  • Suggested answer
    EricRegnier Profile Picture
    2 on 25 Oct 2024 at 07:14:22
    multiple level of expansion in webapi
    Hi @svignesha and @Bipin_D365,
    Note that N:N (many-to-many) relationship are supported with Web API. There's also a nice tool from XrmToolBox to easily manage Web API request especially more complex ones: https://www.xrmtoolbox.com/plugins/GuidoPreite.DRB/
     
    Here's an example of an expand on a N:N relationship:
    ​​​​​​​$expand=new_gridlayerdimension_entities($select=new_entityid)&$filter=acn_gridlayerentitydimensionid eq 07f55627-fc91-ef11-8a69-6045bd9883e2
    Hope this helps!
  • Suggested answer
    Bipin D365 Profile Picture
    28,961 Moderator on 13 Jun 2020 at 16:26:10
    RE: multiple level of expansion in webapi

    Hi,

    You can only use expand with lookup field. It does not work with N:N relationship.

    To solve your issue you might have to use 2 web api.

    If found helpful, Please mark my answer verified.

  • Johao Larios Profile Picture
    1,795 on 07 Apr 2020 at 19:39:50
    RE: multiple level of expansion in webapi

    Hello Vicky,

    Please take a look on this one:

    docs.microsoft.com/.../query-data-web-api

    Check this one as well:

    docs.microsoft.com/.../retrieve-related-entities-query

  • Vicky patidar Profile Picture
    10 on 07 Apr 2020 at 16:35:07
    RE: multiple level of expansion in webapi

    Hi

    I there any solution for above issue.

    Thanks

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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... 293,333 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,276 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Loading started
Loading complete