【问题标题】:Salesforce SOQL Query to Retrieve Users that Downloaded ContentSalesforce SOQL 查询以检索下载内容的用户
【发布时间】:2011-02-24 22:49:38
【问题描述】:

我正在尝试分析哪些用户下载了特定的内容对象。在 UI 上,我可以看到下载的人(以及何时)。有谁知道我可以使用 SOQL 查询什么对象来查看用户 X 下载文档 Y 的时间。

谢谢

【问题讨论】:

  • 它们是附件(带有父对象)或文档(没有父对象),我建议从 Web 服务 API 文档开始,它是数据模型部分 - salesforce.com/us/developer/docs/api/Content/… - 不幸的是它没有不会告诉你你需要知道什么,但可能会提供一些指导。
  • 您是在谈论 CRM 内容还是上面 David Gillen 所说的标准附件和文档?

标签: salesforce


【解决方案1】:

内容下载存储在 ContentVersionHistory 对象中。如果您想查询用户 x 何时下载文档 y,其中 x 是 User.Id,y 是 ContentVersion.Id,那么此代码将带您到那里:

DateTime mostRecentDownloadDateTime;
Id downloadedById = '00550000001NLJsAAO';
Id contentVersionId = '068P000000005ck'; 
List<ContentVersionHistory> mostRecentDownload = 
[select createdDate, field from ContentVersionHistory 
 where createdById = :downloadedById 
 and contentVersionId = :contentVersionId 
 and field = 'contentVersionDownloaded'
 order by createdDate desc
 limit 1];
if(!mostRecentDownload.isEmpty())
 mostRecentDownloadDateTime = mostRecentDownload.get(0).createdDate;

注意内容版本和内容文档之间的差异。根据您的具体用例,您可能会更关心其中一个。

有关完整详细信息,请查看 Salesforce Webservices API 中的内容 ERD 和内容对象。 http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_contentversionhistory.htm http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_erd_content.htm

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-03
    • 1970-01-01
    相关资源
    最近更新 更多