Skip to main content

Notifications

Announcements

No record found.

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

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Filter data in CRM Chart XML

    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>

  • Community Member Profile Picture
    on at
    RE: Filter data in CRM Chart XML

    Thanks much. This works.

    How about filtering data for last 5 weeks?

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Filter data in CRM Chart XML

    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
    RE: Filter data in CRM Chart XML

    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
    RE: Filter data in CRM Chart XML

    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
    RE: Filter data in CRM Chart XML

    I just used Advanced Find for this purpose:

    6036.AF.png

  • Community Member Profile Picture
    on at
    RE: Filter data in CRM Chart XML

    How did you get 4202 and 4210?

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Filter data in CRM Chart XML

    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>


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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans