web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Generate PDF file using JavaScript in Dynamics CRM

(0) ShareShare
ReportReport
Posted on by

I want to convert a ".rdl" report to PDF format using JavaScript and send it with an attachment, the PDF file is attached to the email, but when I send it and open it, the PDF file shows an opening error.

Is there any consideration I should have?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Pawar Pravin  Profile Picture
    5,237 on at
    RE: Generate PDF file using JavaScript in Dynamics CRM

    Hello,

    Please refer following url for reference:

    jsfiddle.net/.../0816jdfq

    ankit.inkeysolutions.com/.../dynamics-crm-2011-creating-e-mail.html

    community.dynamics.com/.../205829

  • Community Member Profile Picture
    on at
    RE: Generate PDF file using JavaScript in Dynamics CRM

    I have also detected that the pdf file that I receive in the email marks the following error:

    " Error.
    Try this action again. If the problem persists, consult the Microsoft Dynamics 365 Community for solutions or contact your organization's Microsoft Dynamics 365 administrator. Ultimately, you can contact Microsoft Technical Support. "


  • Community Member Profile Picture
    on at
    RE: Generate PDF file using JavaScript in Dynamics CRM

    The "CreateEmailAttachment" function is executed after the encodePdf function

  • Community Member Profile Picture
    on at
    RE: Generate PDF file using JavaScript in Dynamics CRM

    In the email it appears attached, the size is 357 bytes, mail reaches me of 679 bytes.

    Captura01.JPG

    And this is the code that I use to attach the file:

    function CreateEmailAttachment(bdy,emailuno) {
    
    
        var activitymimeattachment = Object();
        activitymimeattachment.ObjectId = Object();
        activitymimeattachment.ObjectId.LogicalName = "email";
        activitymimeattachment.ObjectId.Id = emailuno;
        activitymimeattachment.ObjectTypeCode = "email";
        activitymimeattachment.Subject = "File Attachment";
        activitymimeattachment.Body = bdy;
        activitymimeattachment.FileName = "Enviar Oferta.pdf";
        activitymimeattachment.MimeType = "application/pdf";

    }

  • Kokulan Profile Picture
    18,054 on at
    RE: Generate PDF file using JavaScript in Dynamics CRM

    Hi

    It might help if you could add some screenshots and possibly the bit of code that downloads the PDF and then attaches to the email.

    Normally converting to PDF and attaching it to email is done using Server Side Code either using a plugin or CWA.

    If you are doing both of these using JS, please make sure the file size is as expected and also make sure the correct mimetype is set

    The following link has a C# example but the approach is still the same if you are converting an SSRS report to PDF.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans