We recently had a requirement to run a report on the form of a custom entity named incident.
It should show incident data and its related entity data i.e. contact and account.
Incident is having n: n relationship with Contact and Account here.
Here we will create three data sets one for showing the incident data and other two for the related entities.
Create a DataSet for Incident to fetch the incident record information (using Advanced Find View).
Make sure to set enableprefiltering as 1
This will create a report parameter in the report
Next we will create a DataSet for Contact entity which is n: n (many to many) related to Incident.
Download the fetch xml and add enableprefiletering attribute
Follow the same step for the DataSet for account entity related to Incident.
While uploading the select Display in value as “Forms for related record types” to run the report in the context of the form.
Report will start appearing in the Incident Form
Hope it helps