0

I'm trying to send an email reply via the REST API for a case created in Service Cloud.

Creation of the emailMessage itself and the emailMessageRelation are working correctly. Creation is done via POST to /data/v49.0/sobjects/EmailMessage/ and the message is visible on the case.

But i'm not receiving the actual email. Do I need an extra send trigger? Is this done via those quickActions? how?

On the SOAP documention found on https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_send_email_message.htm. In the sample they create a draft and an extra sendEmailMessage call.

Thanks for the help.

1 Answer 1

0

Edit: I'd overlooked that this was for REST, so I've made some updates below.

For Apex and SOAP, the sendEmailMessage() must be called on the constructed email.

REST seems to have a special endpoint for actions such as email. See here for documentation: https://developer.salesforce.com/docs/atlas.en-us.api_action.meta/api_action/actions_obj_email_simple.htm

or here: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_actions_invocable_standard.htm?search_text=send%20email

Also note that email deliverability is often turned off in sandbox environments, which could cause the send to silently fail depending on how you handled the try/catch and SendEmailResult response.

I am surprised that the email is showing in the ui if not sent, though. Somehow you've constructed the sobject record but not actually sent it.

5
  • Hi @jimG, how do I call sendEmailMessage() ?
    – TomvD
    Aug 25, 2020 at 11:25
  • It's actually in the SOAP doc link you included: SendEmailResult[] = connection.sendEmailMessage( String[] draftEmailIds);
    – JimG
    Aug 25, 2020 at 11:27
  • yes I know, but how can this be done via rest api call? not using the soap service for now.
    – TomvD
    Aug 25, 2020 at 11:29
  • Whoops, sorry. A quick search is showing this REST endpoint, which is slightly different than the one you mentioned above: developer.salesforce.com/docs/atlas.en-us.api_action.meta/…
    – JimG
    Aug 25, 2020 at 11:36
  • Hi JimG, looks like that is for sending a simple email. Will check later when i receive my proper sandboxes and production env, only have the developer version for now.
    – TomvD
    Aug 25, 2020 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.