Complicating the Simple
I had a recent need during some pre-sales work to try to dispatch an email from CRM 2013 in a totally non-standard way.
The challenge was to CREATE an email activity entity record in CRM from an external application and then use a workflow to try to actually send it rather than either the user clicking on the “Send” button or the workflow using a “Send Email” task.
A solution was not found but some research suggested that the approach chosen may work with the use of the email router as described below.
The Set Up
We were using a CRM 2013 on-premises installation with Update Rollup 1. We had a number of other external systems connecting via the CRM web service API which were creating email entities directly within CRM, such entities are created with DRAFT status.
We were using MS Outlook with the CRM Outlook client installed and connected to Hotmail for the actual email dispatch rather than the effort of setting up an Exchange or using the Email Router
The Build & Test
The challenge then was to detect that an email activity is created and force CRM to send it. To do this I created a workflow which: –
1) Had a scope of organization.
2) Detected the creation of an email activity with a particular title (hacky I know but it was a demo)
3) Updated the email record to set the Number of Delivery Attempts of the email to a number > 0 and the direction to OUTGOING
4) Then updated the status to “Pending Send”
A screenshot of this abomination is below: –
I rather hoped this would be enough and the Workflow did correctly fire and send the email if I manually created a record within CRM. However although it correctly fired and made the changes when the email activity record was created by the external application via the web API the email did NOT get sent 😦
A pretty similar approach to that taken to resend failed emails by this blogger:
With the limited time we did not manage to resolve this, even though we forced the emails in to the PENDING SEND state and set what we believed were all required fields, Oulook just would not relay them on.
We didn’t get time to check but some online research suggested that the only way to enable this approach is to be using the EMAIL ROUTER for email dispatch, I guess it might be polling CRM in a way that is critically different from CRM.
Anyway, I hope it helps anyone else going down this slightly non-standard way.