05-29-2024 04:00 PM
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?
05-30-2024 06:14 AM
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