2

I am doing analysis to get the number of files attached to the each object inside Salesforce. I found that there is a standard object named ContentDocumentLink which has the reference of the each file(i.e. LinkedEntityId field maps the file with the corresponding object). I have tried the approaches listed below but I didn't get the expected result :

  • I have tried to export all the ContentDocumentLink records using Dataloader. But there is a query limitation on the ContentDocumentLink object,it looks like we must provide the LinkedEntityId or ContentDocumentId in filter to export a data. Since I want to get the count of files by grouping the objects from ContentDocumentLink, I cannot specify any objects in my filter as In would require data of every object that has a file attached to their record.
  • I have tried to export using Data Export option in Setup. I have scheduled this export 8 days ago. But so far it shows that 'Your export has been queued'. I don't know how this got stuck or not and when it will be completed.

Apart from the above methods, do anyone have a solution to calculate the No of files present in each object based records. (Eg: Account - 3000 Files Attached Contact - 2000 files Attached Opportunity - 1500 files Attached, Etc)

1
  • Did you find any solution for the above scenario?
    – Sindhuja
    Commented Nov 21, 2023 at 11:24

2 Answers 2

0

So there are many approaches to this problem. But I will mention two. One with code and the other is a manual process.

Code

  1. Supposing you have all the objects you want to search as a text in a custom setting, we can write a batch job and by using the Schema describe, get each object in a batch one by one and count the documents attached (Content Documents). You can aggregate the count in your finish method and send an email once done.

Manual 2. Schedule a report on each object you want to count, and then aggregate the counts.

0

Here is the Official™ answer from Salesforce.

https://help.salesforce.com/articleView?id=000313973&language=en_US&mode=1&type=1

tl;dr: Make each contentdocument visible to to the exporting user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .