Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

Generating Salesforce Case Thread Id Using Apex Class

Be First!
by November 14, 2013 APEX, SALESFORCE, Salesforce.com

Generating Salesforce Case Thread Id Using Apex Class

Case Thread ID:
“Case Thread_Id” Use for Preventing New Cases and Only Allowing Case Updates via Email.

Case Thread ID contatins the combination of Organization Id and Case ID.

Example: VALID
ref:_00Dc0LQjo._500c024Dru:ref

Code Example:

String caseId = ‘500c00000024Dru’;
string Case_ThreadID = ‘_’  + UserInfo.getOrganizationId().left(4)  + ‘0’  + UserInfo.getOrganizationId().mid(11,4) + ‘._’  + caseId.left(4) + ‘0’  + caseId.mid(10,5) + ”;
system.debug(‘CASE THREADID:::’ Case_ThreadID);

Generating Salesforce Case ID with the help of Case Thread Id Using Apex Class:

String case_threadId = ‘_00Dc0LQjo._500c024Dru’;
Id CaseID = Cases.getCaseIdFromEmailThreadId(case_threadId);
system.debug(‘CASE ID:::’ CaseID);

We can get the 18 digit case id.

Generating Salesforce Case Thread ID Using Custom Formula Field:

Create a New Custom Formula field in Case Object with Return type as Text and paste it below statement in Formula Text area section

“ref:_00D”&MID(Id,4,1)&RIGHT($Organization.Id, 4) &”.”& LEFT(Id,4)&RIGHT(Id,5)&”:ref”

(3180)

Previous
Next

Leave a Reply