Hello everyone!
I have been scratching my head on this one for a few days, hopefully someone can give me a fresh perspective!
So, I've built dozens of reports before and they've all worked great with prefiltering. Now, I'm working on a report and I just cannot for the life of me get it to prefilter.
I have
<entity name="new_truck" enableprefiltering="1" prefilterparametername="CRM_new_truck">
in the DataSet query, with CRM_new_truck being a Report Parameter with the following as it's Default Value:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="new_truck"><all-attributes /></entity></fetch>
This appears to be consistent with doing a filtered Report Wizard in CRM, and comparing the RDL that it generates.
Curiously, none of my other reports ever specify prefilterparametername= and they work fine:
<entity name="ditl_traileranalysis" enableprefiltering="true">
There is a CRM_ditl_traileranalysis parameter on this report with the following as it's Default Value:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="ditl_traileranalysis"><all-attributes/></entity></fetch>
So I'm not sure what I'm missing here. It appears that it should be set up correctly. My code for opening the report on the Ribbon is
function openTVSlide() {
var isDirty = Xrm.Page.data.entity.getIsDirty();
if (isDirty == true) {
alert("This form has not been saved. Please save before attempting to generate a report.");
return;
}
// This function generates a Print out
var rdlName = "TV Image.rdl";
var reportGuid = "0D081619-D479-E511-80DF-00505681C656";
var entityGuid = Xrm.Page.data.entity.getId();//Here I am getting Entity GUID it from it's form
var entityType = "10037";
var serverUrl = Xrm.Page.context.getClientUrl();
var link = serverUrl + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;
//openStdDlg(link, null, 800, 600, true, false, null);
window.open(link, "reportwindow", "resizable=1,width=950,height=1000");
}
This is consistent with the code I've used everywhere else, except for changing the reportGuid and rdlName and entityType of course.
I've tried completely deleting the report from CRM, and reuploading, and then amending the button code, but it does the same thing.
I have a feeling I'm missing something really dumb here but I've been going back and forth on this so much I am thinking I can't see the forest for the trees anymore