Nick,
I realize this is a pretty old thread but am hoping you can help with a very similar issue. I inherited some reports I am trying to get to work. The first one is "Case events for this case." As described, this should list all of the events (Appointments) for the current case. It is only available the from the Appointments screen for the case which filters by the current case. I think this is the exact scenario described by the OP.
I have tried quite a few variations on the original FetchXML but nothing has produced the correct results. It started with the enableprefiltering="1" on a "link-entity" to incident from the appointments entity. That didn't work either.
I came across this post and tried implementing your solution. It works inside Visual Studio but not in CRM.
I created a dataset that filters by incident:
FetchXML for Incident filter dataset:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="incident" enableprefiltering="1" >
<attribute name="title" />
<attribute name="incidentid" />
<order attribute="createdon" descending="true" />
</entity>
</fetch>
As soon as I save this dataset, the report automatically generates a new "CRM_incident" parameter:
"<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="incident"><all-attributes /></entity></fetch>"
I created a second dataset to use the incident id to get the appointments:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="appointment" >
<attribute name="isalldayevent" />
<attribute name="subject" />
<attribute name="location" />
<attribute name="scheduledstart" />
<attribute name="new_scheduledatetype" />
<attribute name="new_eventdescription" />
<attribute name="new_date" />
<order attribute="new_date" descending="true" />
<filter type="and">
<condition attribute="new_caseid" value="@caseId" uitype="incident" operator="eq"/>
</filter>
</entity>
</fetch>
When I pass the appropriate "@CaseId" in the report building in Visual Studio, the results are correct. However, when I update the report in Dynamics CRM Online, the report is empty. I added a couple text boxes to the report to display the information (Title in header and ID in footer) from the selected incident.
When the report runs, the Case Title / ID displayed is not the id of the record currently being viewed. My thought is it is an issue with the auto generated FetchXml in the CRM_incident parameter. It appears to be the most recently created case which would match the order by clause.
Any ideas how to fix this issue? How do I get the current incidentid into the report?