web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Report to display related records of a lookup record.

(0) ShareShare
ReportReport
Posted on by 277

Hello Experts

We have 2 entities A and B, they are both child entities of Opportunity but they are not related to each other. But we need to run a report on 'A' to get all the records of 'B' that are associated to the opportunity lookup field on 'A'. I created an OOB report and displaying it on entity 'A' but it is showing all the entity 'B' records in CRM. I haven't created reports using code before, please suggest.

*This post is locked for comments

I have the same question (0)
  • Jim Crook Profile Picture
    on at

    I think this may be a good start www.itaintboring.com/.../dynamics-crm-tcs-tools-user-a-workflow-to-update-related-entities

    This is a workflow plugin that I think may, with some thinking, get you closer.

    I think there are other ways by using looping workflows and creating fields on Opportunity to compare A with B.  It's a bit messy and again needs some add on workflow plug ins like https://kaskelasolutions.com/

    Good luck

  • Suggested answer
    Preeti Sharma Profile Picture
    2,678 on at

    Hi,

    You can use SSRS for custom reports using fetchxml.

    Below links may help you:

    community.dynamics.com/.../ssrs-reports-for-dynamics-365-using-fetchxml

    community.dynamics.com/.../ssrs-report-using-fetchxml

    Hope this helps:)

  • Turbo Forms Profile Picture
    277 on at

    Hi Preeti

    I'm using SSRS but the problem is creating a fetchXML for my scenario, I couldn't run the report on current record A(Only showing run for all records). On Record there is a lookup for Opportunity, I need to get all related records B associated with that opportunity. I could have done using OOB report if there was a relation between A and B but there is no relation.

  • Suggested answer
    Community Member Profile Picture
    on at

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

     <entity name="A">

       <attribute name="name" />

       <attribute name="primarycontactid" />

       <attribute name="telephone1" />

       <attribute name="accountid" />

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

       <link-entity name="opportunity" from="parentaccountid" to="accountid" link-type="inner" alias="aa">

         <link-entity name="contact" from="contactid" to="parentcontactid" link-type="inner" alias="ab">

           <filter type="and">

             <condition attribute="contactid" operator="eq" value="@contactId" />

           </filter>

         </link-entity>

       </link-entity>

     </entity>

    </fetch>

    Generate fetchXML like this for your entities. Pass Selected A's Id in parameter where I used "<condition attribute='contactid' operator='eq' value='@contactId' />"

    Hope It will help you!

  • Turbo Forms Profile Picture
    277 on at

    Hi Jagmohan, the Xml works as a charm but the report runs with an empty parameter and only displays data when the ID is manually entered in there. Should I do any manual changes to the parameter to pull the current record ID?

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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