cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Accessing Datapills for File Attachments in Salesforce

chadwicke619
Deputy Chef I
Deputy Chef I

Hey everyone! First post! I would love some guidance on what I am trying to achieve. Basically, when we close out an opportunity in Salesforce, there will be a physical PDF contract in the "Files" section of the related list. Clearly that PDF file is associated with the opportunity or the account somewhere, but even looking at all of the related objects, I can't seem to find a datapill that seems like it would represent my attachments. Any suggestions?

1 REPLY 1

mppowe
Executive Chef I
Executive Chef I

I worked just recently with files in Salesforce, but it's been in attaching files to DocumentChecklistItems, not retrieving them.  It also may depend on whether you're using Lightning or Classic.  One way you might be able to get it is by querying ContentDocumentLink where the LinkedEntityId is the Opportunity Id.  In SOQL:

SELECT Id, LinkedEntityId, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '<OpportunityId>'

Again, I haven't done this myself, this is just from searching around the web a bit.  My bulk insert goes to ContentVersion but I've never been able to query that for my attachments, curiously enough