2

My question is in regards to Salesforce's Email-to-Case feature. When I enable the "Create Task from Email" feature from the Routing Email Address Details, the task is created, yet the body of the email is not included in the task. When our reps respond to an email, a completed task is automatically created with the body of the email populated in the "Comments" field.

How can I achieve this same functionality with inbound emails? Is a trigger my only option to pull in the email body, since workflow rules only support Field Updates for the EmailMessage object?

Examples...

This is a task automatically generated after an inbound email is received. inbound email task

This is a task automatically generated after an outbound email has been sent. outbound email activity

1 Answer 1

0

Process builder!

I wasn't sure if this would work, but sure enough...

As of Spring '15 you can use the Process Builder for cool stuff like this.
Setup > Create > Workflow & Approvals > Process Builder

Previously this would have had to be done using APEX. I believe you would have to do something similar to what's being shown below in the Process Builder - create a new Task (not update the automatic one) since there's no real link between the EmailMessage record and the Task created from it.

Make sure you turn off the automatic Task creation for this routing address in the Email2Case settings or you'll get a duplicate.

Basically, when an Email Message comes in where IsInbound = True, create a task, relate it to the Case, set the Type, etc....

Here's an example

good luck!


quick note:
I had a problem the first time I tried this where the email bounced back to the sender with an ugly error. This is because Cases in my org are owned by a Queue and I tried to set Assigned To ID to the Case Owner. Since it wasn't a User, it wouldn't work. You can specify any User such as the Account.Owner. I used EmailMessage.CreatedBy. That just uses the automated workflow user I think.

"Unhandled process fault" 
caused by element : FlowRecordCreate.myRule_1_A1
caused by: UPSERT --- UPSERT FAILED --- ERRORS : (FIELD_INTEGRITY_EXCEPTION)     
Assigned To ID: id value of incorrect type: 00G30000002SjhQEAS --- for SFDC record with ID : null,

Name ID on the Activity might be problematic as well. You could use the parent Case's Contact field but that might either not be set, or could be someone different than the actual sender.

Make sure whatever you do that no Process Builder, Workflow, Validation, APEX errors will prevent emails from being processed.

2
  • Wow, thank you so very much for this detailed explanation. I intend to try to this out as soon as possible (of course, in a sandbox so no ugly errors get sent to our customers ;) ) I'll let you know how it goes! Commented Jun 4, 2015 at 21:28
  • no worries - I'm having a lot of fun with process builder and happy to learn along with you. If the answer was helpful please mark it as answered so that it can be of more use to more people..
    – RyanP
    Commented Jun 5, 2015 at 2:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .