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
    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 Dec 21 '14 at 18:41
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.