Monday, January 21, 2013

Reopened incident count using FetchXML in MS CRM 2011

Get all reopened incident count using FetchXML. It will include those tickets also for which state code changed more than twice.

<fetch aggregate='true'>
  <entity name='incident'>
    <attribute name='incidentid' aggregate='countcolumn' alias='countincident' distinct='true' />
    <filter type='and'>
      <condition attribute='statecode' operator='eq' value='0' />
    </filter>
    <link-entity name="incidentresolution" from="incidentid" to="incidentid" alias="aa" distinct='true'>
    </link-entity>
  </entity>
</fetch>


<fetch distinct='false' mapping='logical' aggregate='true'>
  <entity name='incident'>
    <attribute name='title' alias='IncidentReOpenCount' aggregate='countcolumn' />
    <filter type='and'>
      <condition attribute='statecode' operator='eq' value='0' />
    </filter>
    <link-entity name='incidentresolution' from='incidentid' to='incidentid' alias='aa'>
      <attribute name='incidentidname' alias='IncidentName' groupby='true' />
    </link-entity>
  </entity>
</fetch>












2 comments:

Unknown said...

Keep up the fantastic piece of work, I read few blog posts on this web site and I believe that your site is real interesting and has lots of great information. ERP Software in Mumbai || System Software || CRM Software in Mumbai || MLM Software

Unknown said...

I really appreciate spending some time to talk about that, I believe firmly regarding this and so really enjoy understanding more about this kind of subject.This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something like this. CRM Software || MLM Software in Mumbai || ERP Software || System Software in Mumbai