+ Start a Discussion
tawfik-haitawfik-hai 

​Case Thread ID gets expanded


​Hi everyone,

We are using a visualforce page to host buttons to create case related emails.
The problem is that the Thread ID gets expanded by 3 digits and gets added at the top of the email for no reason.
for example, it changes from [ ref:_00D30ups._50040qCn7G:ref ] to [ ref:_00D30ups._50040qCn7GAAS:ref ]

It makes the system creates a new case insead.

The email-to-case setting is set NOT to include Thread ID in Subject or body, we have this as a field in the template itself.


Any help is appreciated.
 
Andy BoettcherAndy Boettcher
This looks like the good ol' 15 vs 18 character Id coming up to bite you in the rear again.

Do this - make a new formula field on the Case with this formula:
 
"ref:_00D"&MID(Id,4,1)&RIGHT($Organization.Id, 4) &"._"& LEFT(Id,4)&RIGHT(Id,5) &":ref"

That should chop off the extra characters and close the loop.

As for that information getting automatically added on your VF template - can you post the code?  (remember to use the <> button to format!)
 
tawfik-haitawfik-hai
Thanks so much, but the Thread ID formula is not involved at all. here is the VF page code for the button: The default subject line of the template has NO Thread ID. The email-to-case settings for adding the Thread ID automatically is off: Insert Thread ID in the Email Subject[image: Not Checked]Insert Thread ID in the Email Body[image: Not Checked]Place User Signatures before Email Threads The email is initially generated with no Thread ID in the subject line. However, when submitted, it is received with the Thread ID+3extra letters, this causes the creation of a new case. Regards.
tawfik-haitawfik-hai
Thanks so much, but the Thread ID formula is not involved at all.
here is the VF page code for the button:


<apex:commandButton value="Case Email"  style=" border:3px solid flash black; horizontal-align:right;background:red;colour:white;width:200px; height:30px" action="https://na2.salesforce.com/email/author/emailauthor.jsp?&p2_lkid={!Case.ContactId}&p2={!Case.Contact}&p3_lkid={!Case.Id}&p3={!Case.CaseNumber}&template_id=00X40000001Ip6W&retURL=%2F{!Case.Id}"></apex:commandButton>


The default subject line of the template has NO Thread ID.
The email-to-case settings for adding the Thread ID automatically is off:


Insert Thread ID in the Email Subject [Not Checked]
Insert Thread ID in the Email Body [Not Checked]
Place User Signatures before Email Threads


The email is initially generated with no Thread ID in the subject line.
However, when submitted, it is received with the Thread ID+3extra letters, this causes the creation of a new case.

Regards.
Andy BoettcherAndy Boettcher
That's a tough one - "URL hacking" is officially unsupported by Salesforce and they won't be able to help.  You probably have uncovered a bug but you can try logging it with support and see if they take it anywhere?
Benoit Ecomard 4Benoit Ecomard 4
Hi,
I faced a similar issue with a VF page containing a href URL for the email editor:

location.href='/_ui/core/email/author/EmailAuthor?isdtp=nv&rtype=003&template_id=XXX&saveURL=/apex/PageClose&retURL=/apex/PageClose&p3_lkid={!Case.Id}&p6=Ticket {!Case.CaseNumber} {!Case.TECH_ThreadID__c}'

In the URL I use a custom formula ThreadID that determines the salesforce threadid fir the case.
Doing this, the merge field was ok for the subject 'Ticket XXX ThreadID' with a correct ThreadId but the email was received with an expanded Thread ID.
I added the template ID as another parameter and in URL and like magic (cf above), the thread ID is not expanded anymore when the email is sent !
Try to do the same and check if it solves your issue.
ministe2003ministe2003
I believe this is is not caused by your custom thread ids, but by a salesforce bug which I have reported.  The issue is that your links pass through an 18 character case Id to the EmailAuthor page.  This is what causes the bug.  Try passing through the 15 character case Id instead and this should fix it.
The real fix of course is that Salesforce need to check the length of the case Id in the url before they create their thread Id