function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SF_GuhaSF_Guha 

Fetching Email sender address in the Case Trigger

On Behalf of my colleague:

I'm writing a trigger in the Case

There is a Case created with Email-to-Case. Email is present as the Related list. There is a column in the email related list which shows the sender address of the Email (Email Address in the Image).
User-added image
How to get that particular sender's address in the Trigger.

FYI. I could not find any Email related field (that forms the lookup relationship) in the Case
Eli Flores, SFDC DevEli Flores, SFDC Dev
something like this:

list<EmailMessage> = [SELECT Id, FromAddress, FromName, ToAddress, MessageDate
                                           FROM EmailMessage 
                                           WHERE parentID = :caseId];

should do the trick.