You need to sign in to do that
Don't have an account?
Jeremy York 7
Help with a query on Email Message object
I need help creating a query that will retrieve(email message record id) from email message object only the oldest records(by created date) per case record. I need to archive and purge any email messages on cases with leaving just the most recent email message record on the case.
you can use the following query :
select id, Contact.Id, SuppliedEmail, (select id, ccaddress, BccAddress, FromAddress, Subject, ToAddress from EmailMessages) from case
Please let me know if I can help you more on it.
Thanks,
Vishal
We can put order by to get latest Email, like below query :
select id, Contact.Id, SuppliedEmail, (select id, ccaddress, BccAddress, FromAddress, Subject, ToAddress from EmailMessages order by CreatedDate ASC) from case
Thanks,
Vishal