Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Report to display related records of a lookup record.

Posted on by 275

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
    Turbo Forms 275 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
    Community Member Microsoft Employee 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
    Turbo Forms 275 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
    Preeti Sharma 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
    Jim Crook 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

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans