To run a report from a ribbon button you need to create a js file with a
function you'll be calling from your button.
You need 4 things:
To add it to a ribbon button you need to do like in this post How to start a Dialog from Application Ribbon (CRM 2011) except you need to call report instead a dialog.
You need 4 things:
- rdlName - rdl file name.
- reportGuid GUID of the report.
- entityGuid = Entity GUID wich you run report for.
- entityType = Entity Object Type Code.
function printOutOnClick() {
// This function generates a Print out
var rdlName = "SomeReport.rdl";
var reportGuid = "9A984A27-34E5-E011-B68F-005056AC478A";
var entityGuid = Xrm.Page.data.entity.getId();//Here I am getting Entity GUID it from it's form
var entityType = "4214";
var link = serverUrl + "/" + organizationName + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;
openStdDlg(link, null, 800, 600, true, false, null);
}
openStdDlg() is the wrapper around window.open() MS Dynamics CRM uses it
itself, so do I.To add it to a ribbon button you need to do like in this post How to start a Dialog from Application Ribbon (CRM 2011) except you need to call report instead a dialog.
No comments:
Post a Comment