You need to sign in to do that
Don't have an account?
Christos Kolonis
How to get Attachments related to Opportunity
Hello,
I am trying to get the Attachments related to Opportunity but in my query no attachments are found. I used the above code:
This query doesn't return any records. However the Attachments exist in this related list.
Any ideas of how to get those attachments?
Thank you.
I am trying to get the Attachments related to Opportunity but in my query no attachments are found. I used the above code:
opportunity opp = [select id, name from opportunity]; list<Attachment> attList = [select id, name from Attachment where ParentId = :opp.id];
This query doesn't return any records. However the Attachments exist in this related list.
Any ideas of how to get those attachments?
Thank you.
For objects such as Account - Contacts, Opportunities, Contracts, Tasks, etc, in lightining experience attachments are not available, only files. So, as you can see when you try to upload a file, only "Upload File" is available and not "Attach File". The last option is only available to Salesforce Classic.
So, in order to get those records you have to query like this: