I am trying to retrieve attachments for emails on a specific case using SOQL and not having much success. I am trying using following
Select id, Name, Body, ContentType, parentId from Attachment where parentId in (select (select id from EmailMessages) from Case where Id = '5005700001Oz5na')
I get unknown parsing error I guess because of the inner select statement. Can anyone point me in the right direction.
Best Answer
You can't use a sub-query in a
Left Inner Join
. If you want to getAttachment
records looking up toEmailMessage
records under a specificCase
, you would use a direct query onEmailMessage
in your join filter: