Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to get correct data in SSRS report.

Posted on by

Hello All Experts,

i have created four dataset.

1.Activitytocustomentity

2.Appointmenttocustomentity

3.Tasktocustomentity

4.Phonecalltocustomentity

within the report  1.dataset and some fields as expression from 2 and 3 and 4th dataset i am using but there is only a single value getting populated along with first dataset .

how to avoid this.

Below is my fetchxml first 1.dataset. i.e (Activitytocustomentity)

<?xml version='1.0'?>
<fetch distinct='false' mapping='logical' output-format='xml-platform' version='1.0'>
<entity name='activitypointer'>
<attribute name='activitytypecode'/>
<attribute name='subject'/>
<attribute name='statecode'/>
<attribute name='prioritycode'/>
<attribute name='modifiedon'/>
<attribute name='activityid'/>
<attribute name='instancetypecode'/>
<attribute name='community'/>
<attribute name='scheduledstart'/>
<attribute name='sortdate'/>
<attribute name='slaid'/>
<attribute name='scheduleddurationminutes'/>
<attribute name='regardingobjectid'/>
<attribute name='stageid'/>
<attribute name='ownerid'/>
<attribute name='onholdtime'/>
<attribute name='modifiedonbehalfby'/>
<attribute name='modifiedby'/>
<attribute name='leftvoicemail'/>
<attribute name='lastonholdtime'/>
<attribute name='exchangerate'/>
<attribute name='scheduledend'/>
<attribute name='description'/>
<attribute name='deliveryprioritycode'/>
<attribute name='senton'/>
<attribute name='deliverylastattemptedon'/>
<attribute name='createdon'/>
<attribute name='transactioncurrencyid'/>
<attribute name='createdonbehalfby'/>
<attribute name='createdby'/>
<attribute name='actualstart'/>
<attribute name='actualend'/>
<attribute name='actualdurationminutes'/>
<attribute name='activityadditionalparams'/>
<order descending='false' attribute='modifiedon'/>
<link-entity name='new_customentity' alias='aa' to='regardingobjectid' from='new_customentityid'>
<attribute name='createdby'/>
<attribute name='ownerid'/>
<attribute name='new_uniqueid'/>
<filter type='and'>
<condition attribute='createdon' value='2017-01-01' operator='on-or-after'/>
<condition attribute='createdon' value='2017-12-31' operator='on-or-before'/>
</filter>
</link-entity>
</entity>
</fetch>

2. dataset  fetchxml. i.e (Appointmenttocustomentity)

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="appointment">
<attribute name="subject" />
<attribute name="statecode" />
<attribute name="scheduledstart" />
<attribute name="scheduledend" />
<attribute name="createdby" />
<attribute name="regardingobjectid" />
<attribute name="activityid" />
<attribute name="instancetypecode" />
<attribute name="new_winplandimension" />
<attribute name="new_subcategorydescription" />
<attribute name="new_subcategoryid" />
<attribute name="subcategory" />
<attribute name="statuscode" />
<attribute name="sortdate" />
<attribute name="slaid" />
<attribute name="overriddencreatedon" />
<attribute name="stageid" />
<attribute name="processid" />
<attribute name="prioritycode" />
<attribute name="ownerid" />
<attribute name="onholdtime" />
<attribute name="modifiedon" />
<attribute name="modifiedonbehalfby" />
<attribute name="modifiedby" />
<attribute name="new_meetingminutesinternal" />
<attribute name="new_meetingminutesexternal" />
<attribute name="location" />
<attribute name="lastonholdtime" />
<attribute name="exchangerate" />
<attribute name="ap_engagementtype" />
<attribute name="scheduleddurationminutes" />
<attribute name="description" />
<attribute name="transactioncurrencyid" />
<attribute name="createdon" />
<attribute name="createdonbehalfby" />
<attribute name="category" />
<attribute name="new_categoryid" />
<attribute name="isalldayevent" />
<attribute name="activityadditionalparams" />
<attribute name="avanade_adhoc" />
<attribute name="actualstart" />
<attribute name="actualend" />
<attribute name="actualdurationminutes" />
<attribute name="activitytypecode" />
<attribute name="avanade_activityplanid" />
<order attribute="subject" descending="false" />
<link-entity name="new_customentity" from="new_customentityid" to="regardingobjectid" alias="ab">
<attribute name="ownerid" />
<attribute name="new_caseid" />
<filter type="and">
<condition attribute="createdon" operator="on-or-after" value="2017-01-01" />
<condition attribute="createdon" operator="on-or-before" value="2017-12-31" />
</filter>
</link-entity>
</entity>
</fetch>

likewise the other two has fetchxml

*This post is locked for comments

  • Suggested answer
    Preeti Sharma Profile Picture
    Preeti Sharma 2,678 on at
    RE: How to get correct data in SSRS report.

    Hi EmployeeOcta,

    Yes sure I can try to help you.

    Firstly, let me show you a fetch xml that will bring oput all activities( with type appointment,phone call and Task) related to account entity.

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="activitypointer">
        <attribute name="activitytypecode" />
        <attribute name="subject" />
        <attribute name="statecode" />
        <attribute name="prioritycode" />
        <attribute name="modifiedon" />
        <attribute name="activityid" />
        <attribute name="instancetypecode" />
        <attribute name="community" />
        <order attribute="modifiedon" descending="false" />
        <filter type="and">
          <condition attribute="activitytypecode" operator="in">
            <value>4201</value>
            <value>4212</value>
            <value>4210</value>
          </condition>
        </filter>
        <link-entity name="account" from="accountid" to="regardingobjectid" link-type="inner" alias="ab">
          <attribute name="address1_county" />
          <attribute name="address1_city" />
          <attribute name="address1_composite" />
          <filter type="and">
            <condition attribute="createdon" operator="on-or-after" value="2010-12-26" />
            <condition attribute="createdon" operator="on-or-before" value="2018-02-10" />

    <condition attribute="accountid" operator="eq" value="@Account"/>
          </filter>
        </link-entity>
      </entity>
    </fetch>

    Where Account can replace your custom entity name. Also please note that @Account is parameter that will contain  id of record for which current report will run. You can get value for this parameter by making a separate dataset (say AccountDataset) that fetches all Accounts. Enabling prefiltering to this dataset (i.e. AccountDataset) will return id for current record only (for which report is running). Set default value of Account parameter as AccountId from AccountDataset .

    Please let me know if you have any confusion regarding this.

  • EmployeeOcta Profile Picture
    EmployeeOcta on at
    RE: How to get correct data in SSRS report.

    Hello Preeti,

    Can you help me in creating such type of fetchxml.

  • Suggested answer
    Preeti Sharma Profile Picture
    Preeti Sharma 2,678 on at
    RE: How to get correct data in SSRS report.

    Hi,

    If I am not wrong you want to create only one dataset that will contain fields you are getting from all four datasets now.

    If this is the case then rather than fetching individual entities try fetching fields from "custom entity" and then fields from entities related to this "custom entity" .

    HTH:)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans