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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Workflow using SendEmailFromTemplateRequest - can I add a dynamic attachment

(0) ShareShare
ReportReport
Posted on by 1,703

CRM2016

With excellent help and suggestions from here, I have been able to create a workflow that emails with attachments. Now I want to take it to the next stage

We currently retrieve reports from an external source, process them and create a pdf report for our clients. What I am looking to try and accomplish ( if possible) is to have one generic email template and add the customers pdf report to it.

I have been following several examples of creating an email from a template , which I have managed to do, however , non of them say anything about adding an attachment . Is it possible to do this ? I have seen threads about attaching the attachment when creating the email template , but surely that is for a static attachment.

 

I'm presuming that the following line creates the email with the template, but does anyone have any examples of how to then attach an attachment

                    Dim eamilUsingTemplateReq As SendEmailFromTemplateRequest = New SendEmailFromTemplateRequest With {.Target = email, .TemplateId = _TemplateId, .RegardingId = _ContactId, .RegardingType = Contact.EntityName}

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    When you select a template email, the attachments of the email template or automatically added to the email message when it is sent.

    It seems like you are looking to have a different email attachment to each target recipient, is that correct?

    I am not if you are able to directly do this with an email template, but you might be able to get the template, generate the email from it, add the attachments for each individual recipient, and then send the email (as non-template email), but with the look and feel of the email template by using the email template class properties.

    See the following links which might help you out:

    msdn.microsoft.com/.../gg334240.aspx

    msdn.microsoft.com/.../gg334461.aspx

    msdn.microsoft.com/.../hh210212.aspx

    Hope this helps.

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Pete,

    For static attachments, you can add the attachments directly to the template. If you are looking for attachments specific to each email then I don't think it is possible to attach it using the SendEmailFromTemplateRequest.

    This is because  to add an attachment to an email programtically, you need to have a the email instance created to which you add the attachments whereas 'SendEmailFromTemplateRequest ' create & sends the email when you execute this method.

    May be you can look for ways to create the email like your template (without using email templates) and then use the normal code to attach and send the email.

    Hope this helps.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans