January 7, 2019

Open CRM Report with Javascript

To run a specific report against selected items with Javascript, use the code below.
Create a button in a ribbon and pass the following parameters: SelectedControl, SelectedControlItemIds, SelectedEntityTypeName

Beware that this is totally unsupported way of doing a this.

function openReport(gridControl, recordIds, selectedEntityType)
    var reportId = "{reportGuid}";
    var filterTable = true;
    var reportType = 1;
    var fileName = "REPORT NAME.rdl"
    Mscrm.RunReportFromGrid.$j(gridControl, recordIds, filterTable, reportId, reportType, fileName);