Skip to main content

Notifications

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

  • Turbo Forms Profile Picture
    277 on at
    RE: Report to display related records of a lookup record.

    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?

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Report to display related records of a lookup record.

    <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
    RE: Report to display related records of a lookup record.

    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
    Preeti Sharma Profile Picture
    2,678 on at
    RE: Report to display related records of a lookup record.

    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:)

  • Jim Crook Profile Picture
    on at
    RE: Report to display related records of a lookup record.

    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

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 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…

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 54

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans