I did not get any result from querying notes and attachment.

Setup I create a custom object. I added notes and attachment to the custom object I created soql that filter by parentId and it looks like this.

I created a record on the custom object named 'record1', and on the related tab, I upload notes and attachments named attachment1.

I created a query that looks like this

Select name from attachment where parentId =:(record1 Id);

same with note

Select title from Notes where parentId =:(recordthe 1 Id);

result is 0 record.

1 Answer 1


In Spring'16 release Salesforce introduced Files uploaded to the Attachments related list on records are uploaded as Salesforce Files, not as attachments in Salesforce Files Settings:

Files that you upload to the Notes & Attachments related list on records in Salesforce Classic are now Salesforce Files objects, rather than the old attachment objects. A new org pref in Salesforce Files Settings controls this behavior, and is enabled by default for new orgs.

The following SOQL query would allow you to get Ids of Files (Attachments) and New Notes related to the record

SELECT ContentDocumentId,Id,LinkedEntityId,ShareType 
FROM ContentDocumentLink WHERE LinkedEntityId = 'YourRecordId'
  • 3
    It might be helpful to link the documentation here. There is quite a bit more complexity to the Content area than there was with Attachment.
    – David Reed
    Commented Jan 23, 2019 at 14:27

You must log in to answer this question.

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