locked
Creating Emails as 'sent' without sending RRS feed

  • Question

  • Hi venerable CRM dev folks!

    Is it possible, using the SOAP API, to create email objects which are marked as 'sent' without them actually being sent?  We don't have an Email provider set up with our online CRM instance, but we would like to track (in our CRM) emails sent via a different system for analytics reasons.

    Any thoughts or insights would be gratefully received!

    Cheers!

    Tuesday, July 29, 2014 8:20 AM

Answers

  • Well my good man… I do believe that is quite possible! All you need do is set the Status (statecode) to Complete (usually 1) and the Status Reason (statuscode) to Sent (not sure of the numerical value here.) Wouldn’t want to steal all your fun, now would I? 

    At any rate, I did a quick proof of concept using a standard OOB workflow and changing the state to sent is quite possible. Beware though, you will almost certainly need to create the record; then change the statecode and statuscode fields using a call to SetState. Call it an educated guess. You could just take the easy way out and use the workflow if you can find a suitable trigger. That’s what I would do.

    Cheers!

    JT

    • Marked as answer by Some Guy2 Wednesday, July 30, 2014 8:24 AM
    Wednesday, July 30, 2014 1:44 AM

All replies

  • Well my good man… I do believe that is quite possible! All you need do is set the Status (statecode) to Complete (usually 1) and the Status Reason (statuscode) to Sent (not sure of the numerical value here.) Wouldn’t want to steal all your fun, now would I? 

    At any rate, I did a quick proof of concept using a standard OOB workflow and changing the state to sent is quite possible. Beware though, you will almost certainly need to create the record; then change the statecode and statuscode fields using a call to SetState. Call it an educated guess. You could just take the easy way out and use the workflow if you can find a suitable trigger. That’s what I would do.

    Cheers!

    JT

    • Marked as answer by Some Guy2 Wednesday, July 30, 2014 8:24 AM
    Wednesday, July 30, 2014 1:44 AM
  • Hi,

    To Add to comments added by JT, It is a bit risky to do this if you have email router or outlook setup. An email activity might actually gets processed between the time when the email is created and the status set to Sent.

    The best option is to set the regarding as the contact (so that email will be associated with the contact ) and keep the To fields empty if you want to make sure the emails are never delivered. I have code for CRM 4 (Xrm Standalone application )that does this. We are in the process of upgrading to CRM2013. I might be able to modify it.

    Please let me know.

    Regards,

    Jithesh

    Wednesday, July 30, 2014 1:51 AM
  • Very interesting - thanks!  I will do some tests to see if this works in our setup.
    Wednesday, July 30, 2014 8:24 AM
  • Great idea, but we would want the regarding object to be an opportunity, so this might not work for us.  We'll figure something out, I'm sure.

    Thanks!

    Wednesday, July 30, 2014 8:24 AM
  • Emails are created as "Draft" by default and need to switch to the "Pending Send" status reason. I wouldn't worry about accidentally sending out emails, so long as you avoid Pending Send and just to be safe the "Sending" status reason.
    Wednesday, July 30, 2014 11:03 AM