Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Fetch XML query to return Distinct Cases owned by different teams and their members

Posted on by 165

Hi,

Is there any way to display DISTINCT cases owned by different teams and their members using Fetch XML? A user may belong to multiple teams.

The need is to display all these cases in the SSRS report. I am able to pull the cases and have them grouped by "Team Name" but as users belong to multiple teams so a single case is counted multiple times. 

Here is the sample of Fetch XML query:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="incident">
<attribute name="title" />
<attribute name="ticketnumber" />
<attribute name="createdon" />
<attribute name="incidentid" />
<attribute name="modifiedon" />
<attribute name="statecode" />
<attribute name="ownerid"/>
<attribute name="owninguser" />

<order attribute="title" descending="false" />
<filter type="or">
<condition attribute="ownerid" operator="in" value="@Team" />
<condition entityname="alias_TeamMember" attribute="teamid" operator="in" value="@Team" />
</filter>
<link-entity name="systemuser" from="systemuserid" to="owninguser" link-type="outer" alias="alias_SystemUser">
<link-entity name='teammembership' from='systemuserid' to='systemuserid' visible='false' alias="alias_TeamMember" link-type="outer" intersect='true'>
<link-entity name="team" from="teamid" to="teamid" link-type="outer" alias="alias_team">
<attribute name="name" />
<attribute name="teamid" />
</link-entity>
</link-entity>
</link-entity>
</entity>
</fetch>

  • Suggested answer
    RodRodriguez Profile Picture
    RodRodriguez on at
    RE: Fetch XML query to return Distinct Cases owned by different teams and their members

    Howdy!

    I think you might be able to get what you are looking for with distinct=true using XrmToolBox

    www.itaintboring.com/.../

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans