1. Create a new web resource (javascipt) with following code
function printOutOnClick(rdlName,reportGuid,entityGuid,entityType)
{
var serverUrl = Xrm.Page.context.getServerUrl();
var link = serverUrl + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;
window.open(link);
}
var link = serverUrl + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;
window.open(link);
}
. 2.Create a new button using visual ribbon editor and pass parameter as follows
Function Name: printOutOnClick
Library: $webresource:<created web resource name>
1. String parameter Value: <Name of report file> ("somereport.rdl")
1. String parameter Value: <Name of report file> ("somereport.rdl")
2.String parameter Value: < Id of Report >
3.Crm parameter: FirstPrimaryItemId //to pass current record id
4.Crm parameter: PrimaryEntitytypeCode //to pass entity code.