+ Start a Discussion
DahveedDahveed 

Internal Case Notification

I needed to make a visualforce email template so that I could select a language based on a field on my contact record. It is required to have the {!Case.Thread_Id} merge field in the subject line so it doesn't create a new case everytime a user responds. However in a visualforce email template it tells me it doesn't exist.

Error: Invalid field Thread_Id for SObject Case

 

This is my email header.  Is the Thread_Id merge field not available when using a visualforce email template?

 

<messaging:emailTemplate subject=" {!relatedTo.Thread_Id} {!$Label.Portal_Case_Comment_Subject} {!relatedTo.CaseNumber}" recipientType="Contact" language="{!recipient.Language__c}" relatedToType="Case">

Anyone have a good idea for a workaround?

 

Thanks,

 

Dahveed

Best Answer chosen by Admin (Salesforce Developers) 
JayNicJayNic

My friend, I feel your pain! I hate that I can't just use this everywhere!

mark.silber posted the formula he used to make it a field on the case object:
https://success.salesforce.com/ideaView?id=08730000000XvdHAAS

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

All Answers

JayNicJayNic

My friend, I feel your pain! I hate that I can't just use this everywhere!

mark.silber posted the formula he used to make it a field on the case object:
https://success.salesforce.com/ideaView?id=08730000000XvdHAAS

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

This was selected as the best answer
DahveedDahveed

Man I feel so understood now. Doesn't it seem like salesforce should provide a list of what will and won't work in visualforce templates so you aren't stuck spending hours testing which ones work? Thanks JayNic this is a viable workaround.