1

This question already has an answer here:

I am able to get standard field of parent object in attachment:

SELECT Id, Parent.Name, CreatedBy.Name FROM Attachment

But how to get custom field from parent attachment, something like:

SELECT Id, Parent.Name, CreatedBy.Name, Parent.Custom_Field__c FROM Attachment

How can I achieve this?

marked as duplicate by Himanshu, sfdcfox, Oleksandr Berehovskyi, Santanu Boral, Tushar Sharma Jan 2 '18 at 7:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Note: TypeOf is an optional clause that can be used in a SELECT statement of a SOQL query when you’re querying data that contains polymorphic relationships but it is not yet documented that whether it will support attachment object or not. TYPEOF is currently available as a Developer Preview as part of the SOQL Polymorphism feature. – Himanshu Jan 2 '18 at 5:52

Browse other questions tagged or ask your own question.