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

How to fetch party id in Fetch XML for SSRS Report.

(0) ShareShare
ReportReport
Posted on by

[Edit]

Hi,

I am building Custom SSRS Report where we need the email records with recipient names (To, CC), From and other fields. I am using FetchXML Like below, but we get error in SSRS when we use Activity party fields like To, From in SSRS FechXML datasource. Please provide the steps to get the names of to and from fields.

Also I want to show Appointments, Emails and Phonecalls in a single report.

I get the below error: 

2742.8284.SSRS.gif

This is the Fetch XML I am using:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">

 <entity name="email">

   <attribute name="subject" />

   <attribute name="statecode" />

   <attribute name="createdby" />

   <attribute name="regardingobjectid" />

   <attribute name="activityid" />

   <attribute name="to" />

   <attribute name="from" />

   <order attribute="subject" descending="false" />

 </entity>

</fetch>

*This post is locked for comments

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

    Hello,

    you are searching for partyid, but in which entity?

    Activities? Then fetch the activitypointer with attribute activityid

    Activity parties? then fetch activityparty with attribute partyid

    Hope it helps

  • Community Member Profile Picture
    on at

    You can try using Advanced find to get partyid field.

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">

     <entity name="phonecall">

       <attribute name="subject" />

       <attribute name="statecode" />

       <attribute name="prioritycode" />

       <attribute name="scheduledend" />

       <attribute name="createdby" />

       <attribute name="regardingobjectid" />

       <attribute name="activityid" />

       <attribute name="to" />

       <attribute name="from" />

       <order attribute="subject" descending="false" />

     </entity>

    </fetch>

  • Verified answer
    Somesh2207 Profile Picture
    1,563 on at

    Hi SachinDabre,

    This is a known issue with SSRS when using Activity party. If you directly use the Activity party fields like From, To in emails or phone calls or appointments, SSRS does not read it, because it is not able to show the fields in the columns due to limitations.

    However, if your requirement is to get the names of the recipients and From in SSRS report, you can do that using Fetch XML but it cannot be done directly using the Fetch XML from the Advanced Find. And you need to do some additional grouping and modifications in SSRS.

    The below Fetch XML should give you what you want but it is joined so there will be duplicate Emails per recipient.

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">


    <entity name="activitypointer">
    <attribute name="activitytypecode" />
    <attribute name="subject" />
    <attribute name="statecode" />
    <attribute name="modifiedon" />
    <attribute name="activityid" />
    <attribute name="regardingobjectid" />
    <attribute name="createdon"/>
    <order attribute="createdon" descending="true" />


    <link-entity name="email" from="activityid" to="activityid" alias="email" link-type="outer">


    <attribute name="createdon" />
    <attribute name="scheduledstart"/>
    <attribute name="description" />

    <link-entity name="activityparty" to="activityid" from="activityid" link-type="outer" alias="eparty">


    <attribute name="participationtypemask" alias="epartytype" />
    <attribute name="partyid" />
    <attribute name="activitypartyid" />
    <attribute name="partyidname" />

    </link-entity>
    </link-entity>

    </entity>
    </fetch>

    Since you will get duplicate email records based on the recipient in your data source. While designing the tables, you need to join based on the email id and append the recipient using Coma. You can use the Partcipation Type mask to identify the type of activity party.

    mark this as answer if it resolves your query. I tried and it works.

  • Community Member Profile Picture
    on at

    Hi Somesh,

    Thanks I tried this and I seem to get data in the datasource. How would I get appointments and phone calls in the same Fetch XML.

  • Community Member Profile Picture
    on at

    Thanks Saad.

    But Using To and From in attributes give error in SSRS report as mentioned in my question (updated now to include the screenshot)

  • Somesh2207 Profile Picture
    1,563 on at

    Hi Sachin,

    You can add multiple link entities in the same Fetch XML and include Phone call and appointments in the same way I included emails, it would work.

    Let me know in case of issues.

  • Community Member Profile Picture
    on at

    Thanks Somesh. Thanks a lot for your help. i can work with this, Great

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

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans