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 :
Microsoft Dynamics CRM (Archived)

Filter data in CRM Chart XML

(0) ShareShare
ReportReport
Posted on by

I am trying to filter Activities data based on "activity type" i.e  Filter all records for a chart that has values "Email" and "Phone call".  Here is the code I am trying to use which is not working. 

<entity name="activitypointer">
<attribute name="createdon" groupby="true" alias="_CRMAutoGen_groupby_column_Num_0" dategrouping="day" />
<attribute name="subject" aggregate="count" alias="_CRMAutoGen_aggregate_column_Num_0" />


<link-entity name="Activities" from="activitytypecode" to="activitytypecode" link-type="outer">
<attribute name="activitytypecode" groupby="true" alias="_CRMAutoGen_groupby_column_Num_13" />
<filter>
<condition attribute="activitytypecode" operator="or" >

<value>"Email"<value/>

<value>"Phone call"<value/>

</condition>
</filter>
</link-entity>


</entity>

Any suggestions? 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    You don't need to make any joins to organize filtering. Check following FetchXml:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="activitypointer">
        <attribute name="activityid" />
        <attribute name="subject" />
        <filter type="and">
          <condition attribute="activitytypecode" operator="in">
            <value>4202</value>
            <value>4210</value>
          </condition>
        </filter>
      </entity>
    </fetch>


  • Community Member Profile Picture
    on at

    How did you get 4202 and 4210?

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

    I just used Advanced Find for this purpose:

    6036.AF.png

  • Community Member Profile Picture
    on at

    Oh wow! that's a smart way.

    Another issue is. I have another CRM chart in which I am using some different attributes from activity but still I want to filter data based on Activity type . Here is the code:

    <fetch mapping="logical" aggregate="true">

             <entity name="activitypointer">

               <attribute name="subject" aggregate="count" alias="_CRMAutoGen_aggregate_column_Num_0" />

               <attribute name="createdby" groupby="true" alias="_CRMAutoGen_groupby_column_Num_13" />

               <attribute name="createdon" groupby="true" alias="_CRMAutoGen_groupby_column_Num_14" dategrouping="day" />

             </entity>

           </fetch>

  • Community Member Profile Picture
    on at

    Oh wow! that's a smart way.

    Another issue is. I have another CRM chart in which I am using some different attributes from activity but still I want to filter data based on Activity type . Here is the code:

    <fetch mapping="logical" aggregate="true">

             <entity name="activitypointer">

               <attribute name="subject" aggregate="count" alias="_CRMAutoGen_aggregate_column_Num_0" />

               <attribute name="createdby" groupby="true" alias="_CRMAutoGen_groupby_column_Num_13" />

               <attribute name="createdon" groupby="true" alias="_CRMAutoGen_groupby_column_Num_14" dategrouping="day" />

             </entity>

           </fetch>

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

    Try to use following FetchXml query:

    <fetch mapping="logical" aggregate="true">
    	<entity name="activitypointer">
    		<attribute name="subject" aggregate="count" alias="_CRMAutoGen_aggregate_column_Num_0" />
    		<attribute name="createdby" groupby="true" alias="_CRMAutoGen_groupby_column_Num_13" />
    		<attribute name="createdon" groupby="true" alias="_CRMAutoGen_groupby_column_Num_14" dategrouping="day" />
    		<filter type="and">
    			<condition attribute="activitytypecode" operator="in">
    				<value>4202</value>
    				<value>4210</value>
    			</condition>
    		</filter>
    	</entity>
    </fetch>


  • Community Member Profile Picture
    on at

    Thanks much. This works.

    How about filtering data for last 5 weeks?

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

    Hello,

    Have you tried to do anything before asking here? Advanced find can give you result. Here is what I got:

    <fetch mapping="logical" aggregate="true" >

     <entity name="activitypointer" >

       <attribute name="subject" aggregate="count" alias="_CRMAutoGen_aggregate_column_Num_0" />

       <attribute name="createdby" groupby="true" alias="_CRMAutoGen_groupby_column_Num_13" />

       <attribute name="createdon" groupby="true" alias="_CRMAutoGen_groupby_column_Num_14" dategrouping="day" />

       <filter type="and" >

         <condition attribute="activitytypecode" operator="in" >

           <value>4202</value>

           <value>4210</value>

         </condition>

         <condition attribute="createdon" operator="last-x-weeks" value="5" />

       </filter>

     </entity>

    </fetch>

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans