Pass parameter to RDL

Sometime we need to send parameter dynamically to SSRS report, to achieve it below JS function will help … here key thing is “&p:”, whatever next to this one will be considered as parameter, e.g. “&p:parameterName=parameterValue”. You can pass more than one parameters too.

Here is the actual JavaScript function ….

function OpenRDLReport() {
    //debugger;
    var rdlName = "rpt_SoftSummary.rdl";
    var reportGuid = "DFA6F919-426D-E911-80E6-115056B318E5";
    var entityType = "11061"; 
    var entityGuid = Xrm.Page.data.entity.getId();
    var url = Xrm.Page.context.getClientUrl() + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;
    //Set parameters 
    url = url + '&p:siteID=' + entityGuid;

    window.open(url, null, 'width=1000, height=800, directories=no, location=no, menubar=no, resizable=yes, scrollbars=1, status=no, toolbar=no');
    return false;
}

That’s it for now!!

Thanks!

Some additional links

https://docs.microsoft.com/en-us/sql/reporting-services/pass-a-report-parameter-within-a-url?view=sql-server-2017

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s