You need to sign in to do that
Don't have an account?
tbfan6789
Question on SOQL nest queries (Attachments and Accounts)
Hi, I'm hoping someone can assist me with this. I'm trying to work on a search engine in Salesforce that allows the user to look up the Account Information (Name, Account Identifier, etc..) and the Attachment File Name at the same time. However, I was receiving SOQL errors when trying to join the attachment and account objects (due to the Polymorphic relation via ParentID). What is the best way in Apex to have a list of attachments that include the Account information on each element/record?
You can do this:
Note that you still need a second query to retrieve the Body field, if you want it; binary fields can't be part of a subquery. However, if all you need is a list of attachments, this will work.
All Answers
You can do this:
Note that you still need a second query to retrieve the Body field, if you want it; binary fields can't be part of a subquery. However, if all you need is a list of attachments, this will work.
Thanks for the information. That should help.