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
Dileep RatnayakeDileep Ratnayake 

Retrieve Files Linked to Opportunity

Hi everyone,

Fairly new to SalesForce.
I have been successfully retreiving information through SOQL with the help of workbench.
I need to figure out a way to retrieve files linked to an opportunity.

In short I'm trying to retrieve the photos uploaded against an opportunity.

I managed to get some output by running the below query.
SELECT ContentDocumentId,Id,IsDeleted,LinkedEntityId,ShareType,SystemModstamp,Visibility FROM ContentDocumentLink WHERE LinkedEntityId = 'THE_OPPORTUNITY_ID'
Seems like there is another table that this info needs to be retrieved from.
Is there a way to retrieve a publicly accessible URL for the above files?
 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Dileep,

As you have mentioned the soql query is correct and for publicly accessing the files using link have you checked content deliveries and public links? please find the help article related to it below:

>> https://help.salesforce.com/articleView?id=content_delivery_about.htm&type=5

I hope this helps and in case if this comes handy can you please choose this as best answer so that it can be used by others in the future.

Regards,
Anutej 

 
Gaurav Sharma 472Gaurav Sharma 472
You should also query on attachment object.


Select id,title  from attachment   where parentid = 'your oppty id'