Loading

Report on how many times a piece of content has been downloaded

Data pubblicazione: Jun 23, 2026
Descrizione

When you click on a content element in Salesforce, the Downloads tab shows who downloaded the content. Standard Salesforce reports do not provide this download history. To report on download activity, use the Salesforce API to query the ContentVersionHistory object.

Risoluzione

Querying Download History Using ContentVersionHistory

Download history is stored in the ContentVersionHistory table. To retrieve download records, query this table using a filter on the field column equal to contentVersionDownloaded. The ContentVersionHistory.CreatedById field identifies who downloaded the file, and ContentVersionHistory.CreatedDate records when the download occurred.


To get the count of downloads per user for today, query ContentVersionHistory filtering by Field = 'contentVersionDownloaded' and CreatedDate = TODAY, grouping results by CreatedById. This returns one row per user with a count of their downloads.

SELECT
    count(id) DownloadCountByUser,
    CreatedById
FROM
    ContentVersionHistory
WHERE
    CreatedDate = TODAY
AND
    Field = 'contentVersionDownloaded'
GROUP BY
    createdbyid

 

Querying Content Delivery Downloads

For content delivery download tracking (external sharing), query the ContentDistributionView object. Filter by today's date to retrieve content delivery events. This table includes the distribution ID, the creation date, whether the event was a download, whether it was an internal access, and a parent view ID.

Select DistributionId, CreatedDate, IsDownload, IsInternal, ParentviewID From ContentDistributionView where CreatedDate is Today

 

Performance Considerations

The ContentVersionHistory table can grow very large in active orgs, and unoptimized queries may be slow. To improve performance, always include a restrictive WHERE clause. The most effective approach is to filter by CreatedDate using an indexed date field, such as CreatedDate = TODAY or a specific date range. Avoid broad queries without date filters on this table.

Risorse aggiuntive

ContentVersionHistory

Numero articolo Knowledge

000385125

 
Caricamento
Salesforce Help | Article