Skip to main content

Getting the Case Reference Id

# in email {!Case.Thread_Id}

in apex/other

After Winter'16: Your org still has the broken ref ID, but we no longer parse them, because there is no expectation that we would, and the org ID is incorrect. And we no longer parse it due to a change on our end where we tightened the org ID requirement.

For your reference you can look at below example on how reference it is generated - WE DON'T SUPPORT THE FORMULA BELOW AND FORMAT CAN CHANGE AT ANY TIME:

Organization ID Format: 00DXXYYYYYYYYYY


Acceptable Thread ID Formats: (1) ref:_00DXXyyyyyyyyyy._500AAbbbbbbbbbb:ref (2) ref:00DXyyyyyyyyyy.500Abbbbbbbbbb:ref

For example (example org id): Organization ID = 00D50000000IQwR Case ID = 5005000000PQo5L

Thread ID = ref:_00D50IQwR._50050PQo5L:ref

Custom Formula:

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

NOTE: An important disclaimer here is that any formula you use for this purpose could one day begin failing if the format of the Case ID or Thread/Reference ID changes.