Hi everyone,
I'm trying to update some of our JavaScript for the 9.0 API changes and I'm stuck on trying to run a report from a custom button on the ribbon.
This code works fine:
function (primaryControl) { var formContext = primaryControl; var globalContext = Xrm.Utility.getGlobalContext(); var urlOptions = { height: 600, width: 400 }; var reportName = "<MyReport>"; var entityType = "<EntityType>"; var entityId = TrimBrackets(Xrm.Page.data.entity.getId()); var reportGuid = "<ReportGuid>"; var serverUrl = globalContext.getClientUrl(); var reportUrl = serverUrl + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + reportName + "&id=%7b + reportGuid + "%7d&records=%7b" + entityId + "%7d&recordstype=" + entityType; Xrm.Navigation.openUrl(reportUrl, urlOptions) }
But the moment I try to introduce the replacement for Xrm.Page.data.entity.getId(); I get problems:
var entityId = TrimBrackets(formContext.data.entity.getId());
The above doesn't appear to work for me - no errors.
We're using Microsoft Dynamics 365 9.0 online.
Any ideas?
Kind regards,
Matt
*This post is locked for comments