You need to sign in to do that
Don't have an account?

How to include the case email thread into an email alert?
Hi Team,
Could you advise how to include the case email thread into email alert?
When there is a new email received by a case, SF has a standard function to send out a notificaiton to case owners, and in that notification it includes the customer's new email. We just need the same notification to be sent to another case related user besides the case owner, and we've set up a workflow rule to trigger an email alert. Howver, the merge field {!Case.Email_Thread} don't work in the email template and as confirmed with SF support this is not possible through standard configuration as today.
Would be appreciated if anyone can help with this by coding, thanks in advance.
Could you advise how to include the case email thread into email alert?
When there is a new email received by a case, SF has a standard function to send out a notificaiton to case owners, and in that notification it includes the customer's new email. We just need the same notification to be sent to another case related user besides the case owner, and we've set up a workflow rule to trigger an email alert. Howver, the merge field {!Case.Email_Thread} don't work in the email template and as confirmed with SF support this is not possible through standard configuration as today.
Would be appreciated if anyone can help with this by coding, thanks in advance.
Please refr to this post:
https://success.salesforce.com/answers?id=90630000000gkN1AAI
Thanks,
Pratik
We have an issue with the Case.Email_Thread not populating as part of a workflow rule, which SalesForce support admitted as a known issue.
I am seeking for a workaround, and wonder if you managed to overcome this issue somehow.
Thank you,
Ido.
Same here, I've tried using all of the ones you included and also {!Case.Email_Thread} and this just doesn't work.
I check several other cases in which it was mentioned that using {!EmailMessage.TextBody} was not working but if you used an HTML template and included {!EmailMessage.HtmlBody} it would work - this doesn't work either.
Suprisingly when you open a case with SF their HTML template seems to work just fine because the entire email thread is in each response you get back. Would be nice they included their template as an example.
I worked with SalesForce Support and they clarified that 'Case.Email_Thread' merge field is not supported in a WorkFlow rule.
I was able to overcomet this limitation with a code solution (Apex Class which queried the EmailMessage object, along with an appropriate VisualForce controller to sort the Email Messages into a thread, and a VisualForce Email Template to add the Email Thread in our Email Notification).
Let me know if you want me to share this solution.
Thank you,
Ido.
Doug
I tried the merge field {!EmailMessage.HtmlBody} as part of a Custom HTML Email Template, and it doesn't seem to work - no text is merged.
In regards the code solution, please find below.
Apex Class to query EmailMessage:
*notice we are extracting only the EmailMessages in which the Case Contact was included as To, Cc, or Bcc.
And the matching Test Class:
A VisualForce Component:
And a VisualForce Email Template:
We are using this Email Template as part of a WorkFlow Rule, which Emails the Case Contact after we had to reply back to the case for 3 days. The Email Template includes the whole Email Thread, so the customer has the full context of the handled case.
Hope this helps.
Let me know if you need any more help.
Ido.
@Ido Greenbaum 10 thank you for sharing your solution.