从功能区按钮触发报告 [英] Trigger a report from a ribbon button
问题描述
我有几个自定义报告,我希望能够在功能区中添加触发它们的按钮。
I have several custom reports and I would like to be able to add buttons to the ribbon that trigger them.
有可能吗?如果是这样,那么任何示例都是很棒的!
Is it possible? And if so, any examples would be great !
预先感谢!
推荐答案
要从功能区按钮运行报告,您需要创建一个js文件,该文件具有您要通过按钮调用的功能。
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.
您需要4件事:
- rdlName-rdl文件名。
- reportGuid报告的GUID。
- entityGuid =运行报告所依据的实体GUID。
- entityType =实体对象类型代码。
- 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()是window.open()的包装MS Dynamics CRM使用
openStdDlg() is the wrapper around window.open() MS Dynamics CRM uses it itself, so do I.
要将其添加到功能区按钮中,您需要像这篇文章中一样如何从应用程序功能区(CRM 2011)启动对话框,但您需要调用报告代替一个对话框。
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.
这篇关于从功能区按钮触发报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!