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
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?
<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!
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.
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:)
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
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6