True One-Click to Email report as PDF file

By Dianna on 9/16/2015

This is a true One-Click to Email report as PDF file, for situations where  CRM Users require to frequently email a report, such as price quotation,  as PDF file. If you know how to create a button for this one click function, all you need is to transfer the report GUID, using below JavaScript and Dynamics PDF will complete this process with one click of a button.

Replace the GUID of “var repId” in below script with the report GUID, which can be found in the URL when selecting to edit a report (Workplace>Reports>Select Report>Edit)

function AttachPdf() {
var clientUrl = Xrm.Page.context.getClientUrl();
    var objectTypeCode = Xrm.Page.context.getQueryStringParameters().etc;
    var entityName = Xrm.Page.data.entity.getEntityName();
    var entityId = Xrm.Page.data.entity.getId();
    var repId = "1F7D2FCE-CEBA-E411-80E2-C4346BAC1E44";
    var sendemailurl=  clientUrl+ "/WebResources/do_/dp/pdfpreview.html?id=" + repId + "&data="+objectTypeCode+"&data="+entityName+"&data="+entityId+"&data=SE";
                window.open(sendemailurl);
}


This script calls Dynamics PDF solution>> Download Here


JavaScripts
Dynamics PDF
Author