简体   繁体   中英

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. Do you know If it is possible to query theme using 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. Stupid mistake.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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