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 × +

3 comments:

  1. GET BACK YOUR EX FAST, SAVE YOUR MARRIAGE FROM DIVORCE AND AMEND YOUR BROKEN RELATIONSHIP WITH THE HELP OF DR GREAT CALL OR WHATSAPP +2348118829899

    Hello everyone i am happy to spread my testimony of a strong spell caster called Dr Great. I'm Kaitlyn Houston and i live in USA, my husband and i had a little fight because of that he wanted to divorce me i was so afraid to lose him because i love him very much so i search online for help and i saw a lot of people's testimonies on how Dr Great help them and came out with positive results like Divorces, Cancers, lotteries, fertilities and others. So i emailed him and told him my problem and he told me what to do and I did it as he instructed, 24 hours later he told me he is done with the spell and my husband will no longer divorce me and when my husband came back from work he told me he won't divorce me anymore he said he didn't know what came over him that he is sorry I was so happy and I thank Dr Great for his help If you need Dr Great help email him at infinitylovespell@gmail.com or infinitylovespell@yahoo.com view his blog http://infinitylovespell1.blogspot.com my page https://kaitlynhouston19.blogspot.com you can also add him on WhatsApp +2348118829899 and he will put an end to your problem 

    ReplyDelete
  2. 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
  3. 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