Trigger a report from a ribbon button

∥☆過路亽.° 提交于 2020-01-03 12:31:44

问题


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 !

Thanks in advance !


回答1:


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:

  1. rdlName - rdl file name.
  2. reportGuid GUID of the report.
  3. entityGuid = Entity GUID wich you run report for.
  4. entityType = Entity Object Type Code.

Here is the example.

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.




回答2:


After the RDL name the Guid should be RecordGuid not EntityGuid



来源:https://stackoverflow.com/questions/10583628/trigger-a-report-from-a-ribbon-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!