i want to retrieve the attachments of SObject Account and also i was created a custom field(checkbox) named as is_read__c. Now, using SOQL is it possible to get attachments of Account from attachment SObject where condition is is_read__c = true
-
1What have you tried so far? A direct answer to your question: Yes it is possible to get attachments of Account from attachment SObject. BUT there is no way to add a custom field to the attachment object so not sure what you are referring to there– EricCommented Dec 21, 2014 at 18:41
Add a comment
|
1 Answer
You can query for Accounts and Attachments in one Parent-Child SOQL Query.
SOQL:
List<Account> accounts = [Select Id, is_read__c, (Select Id from Attachments) from Account where is_read__c = true];
As commentators mentioned above you cannot add custom fields to the Attachment object.