function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hugo CostaHugo Costa 

Query of "View All Notes Page"


Can anyone tell me the query to get the same results from “View All Notes & Attachments” page?
The idea is to find the object that saves the attached files in a comment chatter.
Nowadays if you put one attach on a comment you cannot find them by query.
Best regards,
Hugo Costa

Wondering if below query is helping you:
select id, Name,
  (SELECT Title, ContentDocumentid FROM AttachedContentDocuments),
  (Select Id, IsNote, Title From NotesAndAttachments)
   from Account where id = <record-id>
You can also use get same results using single inner query on "CombinedAttachment" table.

Updated query will look like:
select id, Name,
            (Select Id, ParentId, RecordType, Title, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, FileType, ContentSize, FileExtension, ContentUrl From CombinedAttachments)
      from Account where id =<record-id>

As per document (link (
Use this object to list all notes, attachments, documents uploaded to libraries in Salesforce CRM Content, and files added toChatter for a record, such as a related list on a detail page.