Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

Retrieving n:n relation trough liquid on dynamics portal

Posted on by 10

Hi all,

For our community portal I have created a n:n relationship between contact and a custom entity named themes. Here users can, trough a subgrid placed on an entity form available on their profile, show interest in several themes we as a community discuss.

Now I want to fetch all themes a contact is interested in trough this n:n relationship in a liquid fetchXML to create a customised welcome screen for the user on the portal. This themes entity is used trough out the portal so I like to have it as a relation.

in XRM toolbox I was able to build a fetchXML statement to query the needed data. However when on the portal this query does not work. Is it possible to query n:n relations this way? Entity permissions for both entities are set to global read. Is there any other way to fetch the required data? I need the name and guid of the related themes to a contact.

thanks in advance.

Simon

the xml statement:

<fetch top="50" >
  <entity name="contact" >
    <attribute name="firstname" />
    <attribute name="lastname" />
    <link-entity name="bhs_contact_bhs_thema_final" from="contactid" to="contactid" intersect="true" >
      <link-entity name="bhs_thema" from="bhs_themaid" to="bhs_themaid" alias="thema" >
        <attribute name="bhs_name" />
      </link-entity>
    </link-entity>
  </entity>
</fetch>

 

Categories:
  • Suggested answer
    Fubar Profile Picture
    Fubar 2,750 on at
    RE: Retrieving n:n relation trough liquid on dynamics portal

    When you set up the Entity Permissions, you need to use a scope where you chose the relationship between the two entities e.g. Parental (just setting Global at each end of the relationship won't give permission for the system to traverse the relationship/link-table between the 2 entities).

  • Suggested answer
    Psyionic Profile Picture
    Psyionic 195 on at
    RE: Retrieving n:n relation trough liquid on dynamics portal

    Hi Esteday,

    How exactly you are displaying retrieved data? fetchxml on the portal behaves a bit differently than regular fetchxml. To retrieve data from the second level link entity (like in your case) you should just call an alias of that link entity as it was the first level.

    results['thema.bhs_name'] - should return necessary value

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,645 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans