简体   繁体   English

SOQL-查询当前用户正在关注的机会列表

[英]SOQL - Querying for a list of opportunities the current user is following

My app is supposed to display all Salesforce Opportunities which current user follows. 我的应用程序应该显示当前用户关注的所有Salesforce机会。 Do you know If it is possible to query theme using SOQL. 您知道是否可以使用SOQL查询主题。 I have been trying something like this: 我一直在尝试这样的事情:

SELECT Id, Name 
 FROM Opportunity 
WHERE Id IN (SELECT ParentId FROM FeedSubscriptionsForEntity WHERE SubscriberId = '#id')

I have found solution to this problem. 我已经找到解决此问题的方法。

Second select should query from EntitySubscription table not FeedSubscriptionsForEntity property. 第二个选择应该从EntitySubscription表中查询而不是FeedSubscriptionsForEntity属性。 Stupid mistake. 愚蠢的错误。

SELECT Id, Name 
 FROM Opportunity 
  WHERE Id IN (SELECT ParentId FROM EntitySubscription WHERE SubscriberId = '#id')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM