send draft emails through a workflowA client recently had issues implementing a workflow that would send a draft email. Under a normal scenario, you could choose to create a “Send Email” step within a workflow and the job would be done. But what if you have a number of draft emails that you want to push out at a later stage?

One option is, if your email configuration has been set to Email Router then you could issue a SetState Command and set the status to Pending Send with a Number of Attempts set to a value above 0. This would then be sent out next time the email router interrogated your email records.  However, this method is not completely reliable where the email configuration has been set to Server Side Synchronisation.

 

Thankfully, there is an easy solution.  It involves a little custom code, and registering this custom workflow to your CRM.

Step 1: Compile and create a Custom Workflow within Visual Studio.

 

 

Step 2:  Register your workflow DLL to your CRM instance through the Plugin Registration Tool.

Step 3: Create a Workflow Process within Dynamics CRM with the step as pictured below:

create-a-workflow-process

 

Set the Entity Reference for “Email Reference” as such

set-custom-step-input-properties

 

Now you are ready to test your workflow.

I hope that you have found this blog informative. If you have any suggestions or any tricky Dynamics issues you think should be included in future blogs, please drop me a message below.