function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
StenderStender 

Adding Thread ID to emails sent from Custom Object

Hello,

 

I am attempting to implement email-to-case for one of our teams that is already using SF and has some complex business processes.  The issue is that they work from a custom "Work Orders" object, that is related to cases and about half the time they send emails to customer from THERE, not from cases.

 

This means that the 'thread ID' for the case will NOT be inserted into the email when it is sent, so a response will NOT automatically be attached to the case.  I am looking for a way to add this, but it looks like there is not way in apex to add the thread id to the email before it is sent.

 

Is my only option then a custom button?  I guess I would set up a 'dummy' email template that I could reference with a URL hack that just pulls in the thread ID automatically?  This also means that the hundred of email templates (as well as those included in WF) would have to be updated as well to include a merge field for the case's thread ID.

 

Is there an easier and more sure-fire way of doing this?

 

Thanks,
Jeremy Stender

VaasuVaasu
Hey You can create a thread id using formula field on case object and use that formula field to build email subject before sending out a mail.

ref:00D"&MID(Id,4,1)&RIGHT($Organization.Id, 4) &"."& LEFT(Id,4)&RIGHT(Id,5) &":ref

VaasuVaasu
You can build the same threadid using apex and send out an email with that as subject....dont need to create formula field again..
StenderStender

Thanks for the replies, but what I need to do is AUTOMATICALLY include the Thread ID for the case in Emails MANUALLY sent from a custom object related to the case.

 

 

BarnesMichaelLBarnesMichaelL
I know this is an older thread, but you can create a custom email button, and perhaps that could allow you to automatically include the thread id from the formula field in the subject of the outgoing email.
Courtenay MCourtenay M
Adding the proper formula for thread Id to this question (as of two years ago): https://success.salesforce.com/ideaView?id=087300000006trk

"ref:_" & LEFT($Organization.Id,5) & SUBSTITUTE(RIGHT(Organization.Id,11), "0", "" )& "._" & LEFT(Id,5) & SUBSTITUTE(Left(RIGHT(Id,10), 5), "0", "") & RIGHT(Id,5) & ":ref"

I can think of two possible solutions besides using Apex. (1) Make it part of your process for users to select a specific email template when sending an email from a record and have that email template populate the subject/body with the thread. Or (2) configure settings so that the user signature is included in any outgoing emails, and update all user signatures to include the thread ID (for those users who respond to Cases). Option 2 could get messy if you are sending out emails besides case emails and then have the thread ID appearing in every email sent from Salesforce.