---
schema_version: "1"
id: 3ef438959319c48457e4a09afc87f296ba4ebaf8e2d486272a2ec1eb53a1a933
title: getCaseIdFromEmailThreadId(emailThreadId)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_System_Cases_getCaseIdFromEmailThreadId.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_System_Cases_getCaseIdFromEmailThreadId.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3de86425a9499c13e4193fbdf3187ae3bfad4af91724c64ff98446b04ba60abf
description: Returns the case ID corresponding to the specified email thread ID. (Deprecated. Use getCaseIdFromEmailHeaders and EmailMessages.getRecordIdFromEmail instead.)
---
# getCaseIdFromEmailThreadId(emailThreadId)

Returns the case ID corresponding to the specified email thread ID. **(Deprecated. Use getCaseIdFromEmailHeaders and EmailMessages.getRecordIdFromEmail instead.)**

## Signature

public static ID getCaseIdFromEmailThreadId(String emailThreadId)

## Parameters

- **emailThreadId**: Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

## Return Value

Type: [ID](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_id.htm#apex_methods_system_id "Contains methods for the ID primitive data type.")

## Usage

The argument for emailThreadId, also known as Ref ID, has the format !00Dxx01gEW.!500xx0Yktl. This format was introduced in the Winter ‘24 release. The previous format, \_00Dxx1gEW.\_500xxYktl, is supported for backward compatibility, but emails sent from the Winter ‘24 release onward use the new format. Other formats that include ref: or \[ref: aren’t supported by this method.