Hello,
When the case is Approved i want to create PDF and send email as an attachment with Case details in PDF . Please suggest what would be best approach ?
*This post is locked for comments
Hello,
When the case is Approved i want to create PDF and send email as an attachment with Case details in PDF . Please suggest what would be best approach ?
*This post is locked for comments
If you are on an Online Subscription plan, you can do the following:
In CRM:
1. Create a Word Template for the Case record.
2. Have a workflow which does the following: On Case Status change to Approved, use OOB Action to 'SetWordTemplate' and choose the newly created
Word Template.
CheckPoint 1: On Case Approval, you should see the Word Document attached to the 'Notes' section of the Case Record.
In MS-Flow:
Trigger: On create of Note attachment.
Condition: Check if 'IsDocument=true' & FileName = '{TheTemplateName}'
Actions:
1. Upload the attachment to OneDrive. (Do use convertToBase64())
2. Convert the attachment to PDF in OneDrive. (This is the main step)
3. Create a new email in Dynamics365.
4. Create an attachment (from step 2) in Dynamics365. Set regardingObject to the email created in Step 3.
You should now see the email in CRM with the PDF version attached.
Using Flow connectors, you can connect to your SharePoint instance and upload it to the required folder/path.
In My Scenario Once Case is approved and One record is created in ApprovedCase after that only i need to Create PDF based on some pdf format and send email . I want save in sharepointdocumentlocation and relate to Case so that next time we can view this pdf at any time . Pls suggest for this which is best approach ?
Can you pls give some example how to implement it ?
Krishna Prasad,
In addition to the other answers, I just want to mention that such requirements, which involve quite a bit of custom coding / accelerators can be easily achieved through CRM Online, with the power of MS Flow!
But i understand that not every business wants to have CRM Online.
Thanks Aric.. i want to upload PDF in SharepointDocumentlocation is it possible after creating and before sending ?
Thaanks Eric.. i want to upload PDF in SharepointDocumentlocation is it possible after creating and before sending ?
One more thing.
I have not checked this to see if it will work in your case, but Andrew Butenko recently published a tool that allows you to Send an Invoice in PDF format using his Workflow Tools. You should check it out. AFAIK it comes with the Source code.
butenko.pro/.../uwt-email-invoice-in-pdf-format
Thanks Andrew.
Hope this helps.
Also refer this:
crmpankaj.blogspot.in/.../send-pdf-file-as-attachment-in-mail.html
Hi Krishna,
This is not so simple, but the logic would be as follows.
First you need to create an SSRS report, that will take a Case Id parameter (better you prefiltering in this case).
The I would use JS code to do the following:
1. Create an Email Activity using Web Api (or call action), and get the Email Id back from the process.
2. Get the Reporting Session by calling the following function (attached function based on account):
var reportingSession = getReportingSession(accountId);
function getReportingSession(accountId) {
var strParameterXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='account'><all-attributes /><filter type='and'><condition attribute='accountid' operator='eq' value='" + accountId + "' /> </filter></entity></fetch>";
var reportName = "AccountReport.rdl";
var reportGuid = "DC06A823-C265-D311-6144-1252A24B35B1";
var path = context.getClientUrl() + "/CRMReports/rsviewer/QuirksReportViewer.aspx";
var req = new XMLHttpRequest();
req.open("POST", pth, false);
req.setRequestHeader("Accept", "*/*");
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.send("id=%7B" + reportGuid + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName=" + reportName + "&isScheduledReport=false&p:CRM_FilteredAccount=" + strParameterXML);
var x = req.responseText.lastIndexOf("ReportSession=");
var y = req.responseText.lastIndexOf("ControlID=");
var rc = new Array();
rc[0] = req.responseText.substr(x + 14, 24);
rc[1] = req.responseText.substr(x + 10, 32);
return rc;
};
3. Create the attachment object, and call the function to create the attachment:
var attachment = Object();
attachment["subject"] = "File Attachment";
attachment["filename"] = "MyFile.pdf";
attachment["mimetype"] = "application/pdf";
attachment["objectid_email@odata.bind"] = "/emails(" + activityId + ")";
attachment["objecttypecode"] = "email";
attachment["body"] = binaryPDFContent;
createEmailAttachment(attachment)
function createEmailAttachment(attachment) {
return $.ajax({
method: "POST",
contentType: "application/json; charset=utf-8",
url: clientUrl + "/api/data/v8.2/activitymimeattachments",
data: JSON.stringify(attachment),
dataType: "json",
beforeSend: function (xhr) {
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("OData-Version", "4.0");
xhr.setRequestHeader("OData-MaxVersion", "4.0");
}
});
};
The code and logic might have to be tweaked a little for your needs, but hopefully this will help you enough to get you started.
Hope this helps.
Refer this:
community.dynamics.com/.../crm-workflow-email-crm-report-as-pdf-attachment
Hope this helps
André Arnaud de Cal...
293,138
Super User 2025 Season 1
Martin Dráb
231,895
Most Valuable Professional
nmaenpaa
101,156
Moderator