Announcements
There is an entity with name st_salesimpersonate and another entity with name st_salesteam. The two entities are many-to-many relationship, and Relationship Entity Name is st_st_salesimpersonate_st_salesteam. How can I query the relationship data, it seems that the Relationship Entity Name is useless here.
*This post is locked for comments
Your primary entity will be st_salesimpersonate
and link entity will be st_salesteam
something like below:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="st_salesimpersonate ">
<attribute name="fullname" />
<attribute name="contactid" />
<order attribute="fullname" descending="false" />
<link-entity name="st_salesteam" from="accountid" to="parentcustomerid" alias="ab">
<attribute name="accountnumber" />
<filter type="and">
<condition attribute="accountnumber" operator="not-null" />
</filter>
</link-entity>
</entity>
</fetch>
Is there any way I can find/see the link entity?
but I don't know the attribute name of the link entity.
Hi Summer,
If you are using early bound entities you can use syntax like below:
(from ff in serviceContext.FirstEntitySet
join r in serviceContext.SecondEntitySet on ff.FirstEntityId.Id equals r.SecondEntityId
where r.Name == 'SomeName'
select ff)
For query using fetch XML try below (As suggested on https://msdn.microsoft.com/en-us/library/gg328446.aspx) :
StringBuilder linkFetch = new StringBuilder(); linkFetch.Append("<fetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"true\">"); linkFetch.Append("<entity name=\"role\">"); linkFetch.Append("<attribute name=\"name\"/>"); linkFetch.Append("<link-entity name=\"systemuserroles\" from=\"roleid\" to=\"roleid\" visible=\"false\" intersect=\"true\">"); linkFetch.Append("<filter type=\"and\">"); linkFetch.Append("<condition attribute=\"systemuserid\" operator=\"eq\" value=\"" + _userId + "\"/>"); linkFetch.Append("</filter>"); linkFetch.Append("</link-entity>"); linkFetch.Append("</entity>"); linkFetch.Append("</fetch>");
Thanks,
SM,
André Arnaud de Cal...
293,729
Super User 2025 Season 1
Martin Dráb
232,718
Most Valuable Professional
nmaenpaa
101,158
Moderator