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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Fetch XML Report on case resolution

(0) ShareShare
ReportReport
Posted on by 15

I am trying to create a Fetch XML report to view case resolution. However, when I use the following fetch XML to fetch the report it shows to rows with same case number. Is it possible to get only single and latest row using fetch xml?

<fetch distinct="true" >
<entity name="incident" >
<attribute name="ssg_sladate" />
<attribute name="title" />
<attribute name="caseorigincode" />
<attribute name="ticketnumber" />
<attribute name="statecode" />
<link-entity name="incidentresolution" from="incidentid" to="incidentid" link-type="outer" visible="true" >
<attribute name="activityid" />
<attribute name="actualend" />
</link-entity>
<filter type="and" >
<condition attribute="ticketnumber" operator="eq" value="SBS-03474-H2Z1" />
</filter>
</entity>
</fetch>

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at

    I expect your issue is that you have more than one incidentresolution record for a case (this can happen if a case is reopened). As your report includes the activityid for each incidentresolution record , these will appear as a new row.

    If you want only one row per case, you'll need to group by the case, and aggregate the incidentresolution records. For the actualend you can use the max operator, but there's not a useful aggregation for the activityid

    Your fetch should be  something like the following:

    <fetch distinct="true" aggregate="true" >
    <entity name="incident" >
    <attribute name="ssg_sladate" />
    <attribute name="title" />
    <attribute name="caseorigincode" />
    <attribute name="ticketnumber" />
    <attribute name="statecode" />
    <link-entity name="incidentresolution" from="incidentid" to="incidentid" link-type="outer" visible="true" >
    <attribute name="incidentid" alias="incidentid" groupby="true" />
    <attribute name="actualend" aggregate="max" alias="actualend_max" />
    </link-entity>
    <filter type="and" >
    <condition attribute="ticketnumber" operator="eq" value="SBS-03474-H2Z1" />
    </filter>
    </entity>
    </fetch>

  • RaviYadav Profile Picture
    15 on at

    I am getting following error - "An attribute can not be requested when an aggregate operation has been specified and its neither groupby nor aggregate."

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Try following:

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 137 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 57

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans