latest Post

Automatically Sending Draft Emails in MS Dynamics

Recently I found myself wanting to send an email to a bunch of Dynamics CRM Users after doing some data processing from Dynamics in a custom application.

I decided rather than sending the email from the custom application the users would benefit from the email activity being visible within Dynamics for auditing purposes and to also leverage the email error handling already in Dynamics.

Now to achieve this I just created a new email in CRM using the Kingswaysoft CRM destination control in SSIS and  set the status to "Pending Send".

I was thinking this would create the email activity in CRM and then automatically send the email to the users however, I found what actually happened was the email was created in CRM but the email was stuck in "Pending Send".

If I set the email status to draft I could then open the email in CRM and manually hit the "Send" button but I am sure in the past simply setting an email status to pending send would send the email.

I then decided what I would do is create the email in draft then create a workflow which would fire on creation of the email and set the status to "Pending Send". However, again this failed to trigger the email to actually send.

Turns out this feature hasn't worked since CRM 2015 Release 1 it shows how long ago its been since I needed to trigger the sending of an already created email which makes sense as usually you create the email in CRM and send manually or for automated email you create the email from scratch within the workflow.

Anyway to trigger the email automatically from CRM I had to create a custom workflow which fires when a new email is created with a particular subject line which I have blanked out and status reason equals draft. I then make a call to a custom workflow which triggers the sending of the email.



The custom workflow simply calls the following code block to send the email using the SendEmailRequest() SDK method.

Once the custom workflow ran the draft email was successfully sent out. The following two blog posts helped resolve this issue: 

https://crmtipoftheday.com/601/reliably-send-email-in-workflow/
https://trellispoint.wordpress.com/2017/07/28/setting-email-to-pending-send-doesnt-work-dynamics-365/



Recommended Posts × +

4 comments:

  1. Woah, I never knew that this could be done. I am just stunned by the information you shared. Hey? If I do my essay UK will you do it for me? I need an answer to it as soon as possible because I am very much late and cannot waste more of the time. I just need help in real and I don’t know what to do.

    ReplyDelete
  2. I really want to thank Dr Emu for saving my marriage. My wife really treated me badly and left home for almost 3 month this got me sick and confused. Then I told my friend about how my wife has changed towards me. Then she told me to contact Dr Emu that he will help me bring back my wife and change her back to a good woman. I never believed in all this but I gave it a try. Dr Emu casted a spell of return of love on her, and my wife came back home for forgiveness and today we are happy again. If you are going through any relationship stress or you want back your Ex or Divorce husband you can contact his whatsapp +2347012841542 or email emutemple@gmail.com website: Https://emutemple.wordpress.com/ Https://web.facebook.com/Emu-Temple-104891335203341

    ReplyDelete
  3. Very interesting blog. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested inDriven Urban this one. Just thought that I would post and let you know.

    ReplyDelete