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
Shilpa KambleShilpa Kamble 

Unable to access attachments through SOQL

I have added notes and attachments to one of my Account, If I run the below query I am getting notes but not attachements
SELECT Id,name,(SELECT Id, Name FROM Attachments),(SELECT Id, Title FROM Notes) FROM Account
If I run seperate query on attachments, then also I am not getting any attachmants, the result is 0.
SELECT Id, Name FROM Attachment
Does anyone know why the count is getting zero? even though I have attachments in my org.
Best Answer chosen by Shilpa Kamble
sfdcMonkey.comsfdcMonkey.com
try this once :
SELECT Id,name,(SELECT Id, Title FROM AttachedContentDocuments),(SELECT Id, Title FROM Notes) FROM Account

thanks
let me know if it helps you
 

All Answers

Arpit Jain7Arpit Jain7
Are you using Lightning because for lightning attachments are replaced by salesforce file.

Refer below article for the same

https://help.salesforce.com/articleView?id=Attachments-are-not-returned-in-Lightning-Experience-search&language=en_US&type=1

So it might be possible that your uploaded files are stored within Salesforce File. Once search in Files if you are able to get your uploaed documents.

Thanks
Arpit
sfdcMonkey.comsfdcMonkey.com
try this once :
SELECT Id,name,(SELECT Id, Title FROM AttachedContentDocuments),(SELECT Id, Title FROM Notes) FROM Account

thanks
let me know if it helps you
 
This was selected as the best answer