0

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

1
  • 1
    What 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
    – Eric
    Commented Dec 21, 2014 at 18:41

1 Answer 1

4

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.

http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/sforce_api_calls_soql_relationships.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .