0
votes

I have a pretty standard workflow in my Dynamics CRM 2011, which sends email when new entity is created. Now, before email is sent, I'd like to attach some attachments by plugin.

Is it possible to capture some before-send event on email activity, so I could create plugin that before email is sent, do some check on created message, attach files and send it?

Edit:

Files fetched by web service from another system, they are not attachements of other entities in CRM.

2
which kind of attachments? static files or generated at runtime? are already attachments of other entities?Guido Preite
Files fetched by web service from another system, they are not attachements of other entities in CRM.jjczopek
You should be able to do this on pre create or pre update of email. I'm not sure in which order things happen when you click send on an email.Rickard N
But what when my email is created by workflow in Send email activity?jjczopek

2 Answers

2
votes

CRM will create the email and then send it, as two separate actions. So you should be able to add code to a post-create plugin on the email entity which adds the attachment. Presumably your workflow will add some flag to the email so your plugin knows which attachment to add to which email.

0
votes

There are two messages on Email entity: Send and SendFromTemplate. You should be able to create PreSend or PreSendFromTemplate plugins and attach files.