Folks:
I need help with a Webresource Jscript/html script. We are currently on CRM 2011 and using this webresouce script which display the report in the form. It works great on CRM 2011, but in our test environment we have CRM 2015 and it doesn't work. It not even
gives me any error and when I click it is just blank. Any Idea what could be wrong?
<html><head>
<script src="ClientGlobalContext.js.aspx"></script>
<script language="javascript">
function SetReport() {
var entityId = window.parent.Xrm.Page.data.entity.getId();
var entityType = window.parent.Xrm.Page.context.getQueryStringParameters().etc;
context = GetGlobalContext();
var serverAndOrgUrl = context.getServerUrl();
var iframeSrc = 'http://<SERVERNAME>/<ORGANIZATION NAME>' + '/crmreports/viewer/viewer.aspx?action=run&id=%7ba8ea3a06-4563-e311-ad50-40f2e907dd5a%7d';
if(entityId != "") {
iframeSrc = iframeSrc + '&context=records&records=' + entityId + '&recordstype=' + entityType;
}
var report = document.createElement("iframe");
report.setAttribute('id', 'reportFrame');
report.setAttribute('name', 'reportFrame');
report.setAttribute('src', iframeSrc);
report.setAttribute('height', '100%');
report.setAttribute('width', '100%');
report.setAttribute('scrolling', 'auto');
report.setAttribute('frameborder', '0');
report.onreadystatechange = ShowFrame;
var reportDiv = document.createElement("div");
reportDiv.setAttribute('height', '100%');
reportDiv.setAttribute('width', '100%');
reportDiv.appendChild(report);
document.body.appendChild(reportDiv);
function ShowFrame() {
if(report.readyState == "complete") {
menubar = report.contentWindow.document.getElementById('mnuBar1');
if(menubar != null) {
menubar.style.display = "none";
}
editFilter = report.contentWindow.document.getElementById('trEditFilter');
if(editFilter != null) {
editFilter.style.display = "none";
}
}
}
}
</script>
<meta charset="utf-8">
</head><body style="margin: 0px;"></body></html>
Thanks !