web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

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

(0) ShareShare
ReportReport
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>

I have the same question (0)
  • Suggested answer
    RodRodriguez Profile Picture
    on at

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 176

#2
ManoVerse Profile Picture

ManoVerse 149 Super User 2026 Season 1

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 57 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans