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)

Attaching SSRS report along with link to entity records

(0) ShareShare
ReportReport
Posted on by

Hello,
I have the following requirement:
When a user clicks on a button on the out of the box quote entity, it fires off an on demand workflow. This workflow has many steps and one of them is sending an email.In this email however, I need to attach a SSRS report along with other fields in the quote record.
The current implementation does the following : Creates the email with the UI(workflow) where we just enter the to, from subject and the other fields by just looking it up.
Another important thing about this email is that it contains two hyperlinks, one to the quote record and the other to the opportunity record. However, currently it does not have the PDF attachment of the report.
In order to add the PDF report, I naturally have to shift the email to a custom workflow assembly. However, if I do that I will not be able to provide a link to the quote record and the opportunity record right ?
If that's the case, how do I implement this? A link to the quote record, opportunity record and a SSRS report attachment and the email must be sent directly. It should not just be created.
Is it even possible to implement the above requirement?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    tw0sh3ds Profile Picture
    5,600 on at
    RE: Attaching SSRS report along with link to entity records

    Instead of Sending email at once simply create proper email ("Create record" step in you workflow) with all the necessary data. Next - create the Custom Workflow Assembly that will generate your report and PDF. You have two options here - this CWA can must an input of Email that you created (because it must know to what it should append the attachment), so you can send this email directly from this CWA. Or you can just create attachment and then in the next step - simply change the email status to "Pending Send".

  • Community Member Profile Picture
    on at
    RE: Attaching SSRS report along with link to entity records

    Hi Pawel,

    Thanks for the response. You mean create an email in the workflow? After creating the email the next step will be the custom workflow assembly where you attach the report?

  • Suggested answer
    Sergio Macias Profile Picture
    225 on at
    RE: Attaching SSRS report along with link to entity records

    Hi Donald, one question, the pdf you are talking about, is a static pdf? or is a dynamic pdf?

    With dynamic I mean that you generate the pdf during the email process, if it is a static pdf or the same for all your email here is how to attach the pdf

    1. Using the workflow create the email, add the links and fill out the fields you need

    2. Create a workflow activity in C# that receives one parameter, the email as object

    3. Inside the workflow activity you will attach the pdf to the email you have as parameter using c# code

    4. Back in the workflow steps, after the step for the workflow activity you can send the email

    In case you dont know how to do it, please tell me and I will create an example for you.

    You can download crm developer extension from here to start a workflow project and it has templates

    https://marketplace.visualstudio.com/items?itemName=JLattimer.DynamicsCRMDeveloperExtensions

    The result would look like this:

    Bytes.PNG

    *The function read bytes I don´t remember how it is in C#, but here is the idea about the code on your workflow activity, after you create the email using the workflow

  • Community Member Profile Picture
    on at
    RE: Attaching SSRS report along with link to entity records

    Hi Sergio,

    Thanks for the response. My PDF is a dynamic one. So currently how it works is this,

    1) User creates a quote record. If the quote record is created wih business rules based parameters, he needs to request approval of the quote.

    2) The user needs to click on a Request Approval button.

    3) This will fire off a on demand workflow. The steps of the on demand workflow are as following:

    4) Create a quoteapproval record with the status "Pending Approval".

    5) Start a child workflow to get the GUID of the above record created.(This is used to embed it to a static url which is sent in the email)>

    6) Send the email with different parameters passed . Here is where I attach a link to the quote, opportunity and a third party url which contains the GUID of the quote approval record. In this email.

    I need a PDF of the quote. So since am passing the PDF of the details of the quote it is a dynamic one, This PDF is created as a SSRS report which takes the quote guid as input.

    So how do I send the PDF in this email?

  • Suggested answer
    ashlega Profile Picture
    34,477 on at
    RE: Attaching SSRS report along with link to entity records

    Hi Donald,

     just keep in mind this whole business of generating Dynamics SSRS reports in code is a nasty one:) Other than that, here are two examples(I think the second one is, essentially, a copy-paste from the first one.. so much for copyrights:) ):

    butenko.pro/.../ms-crm-2011-general-approaches-to-generation-of-reports

    www.greenbeacon.com/.../ms-dynamics-crm-2013-generating-ssrs-report-as-pdf-using-plugin

     It will not work for Dynamics online, though.

  • Suggested answer
    tw0sh3ds Profile Picture
    5,600 on at
    RE: Attaching SSRS report along with link to entity records
    Yes, after creating email next step is custom activity where you attach report. And then just send the email by changing status (or send it using SDK inside custom activity)
  • Community Member Profile Picture
    on at
    RE: Attaching SSRS report along with link to entity records

    5241.Email.PNG

    Hi Pawel,

    Thanks for the response. So essentialy just changing the status to "Sent" will send the email?

    I have attached a screeenshot. Please take a look at it. In this, there is a email created in the first

    step. In the second step, some values is assigned to it. In the third step, I am just flipping the status

    of that email to sent. Will it actually send the email by doing so ?

  • Community Member Profile Picture
    on at
    RE: Attaching SSRS report along with link to entity records

    Hi Alex,

    Dully noted :) Not much can be done if the requirement is complex.

  • Sergio Macias Profile Picture
    225 on at
    RE: Attaching SSRS report along with link to entity records

    Hi Donald, as per your last answer I understand you already solved the problem on how to generate the report, I´m assuming that you are working with a CRM OnPremise, so I see the workflow activity on your WF  a must, because is where you can put C# code to attach the pdf you already have and convert it to bytes and attach it to the email.

    And if you  use a workflow activity you can remove the child WF because you can send  parameters as input to your WF activity so you can send the links you need.

    The WF activity goes after your step #4

  • Community Member Profile Picture
    on at
    RE: Attaching SSRS report along with link to entity records

    Hi Sergio,

    Thanks for the response. I actually haven't solved my issue. The screenshot in my previous response was another workflow which I just modified a bit to ask a question to Pawel.

    The crux of my current problem is this - I need two important issues to be solved in one single email : - Send a link to the quote record and second is attaching the quote PDF. In order to solve the first part, I think I need to create the email in the CRM workflow interface and create a hyperlink with the Dynamic URL pointing to the quote record. I don't think this can be done by code? Second issue needs to be solved by taking in input the above email and attaching the PDF to that email and then sending it.

    In order to do this, what I was thinking was create an action which takes two input parameters, email as entity reference, PDF string as input and the output as the same email with the PDF attached to that email and sending it. Would this work?

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans