function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lukewarlukewar 

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

 

I am using Salesforce iOS SDK. 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')

 

Unfortunetly I receive error point that there is something wrong with FeedSubscriptionsForEntity.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Rahul_sgRahul_sg
SELECT Id, Name FROM Opportunity
WHERE Id IN
(SELECT ParentId FROM EntitySubscription WHERE SubscriberId = 'userid here')

All Answers

Rahul_sgRahul_sg
use EntitySubscription object
lukewarlukewar

Could you provide an example of this solution. Sorry for basic question but I am new to Salesforce.

Rahul_sgRahul_sg
SELECT Id, Name FROM Opportunity
WHERE Id IN
(SELECT ParentId FROM EntitySubscription WHERE SubscriberId = 'userid here')
This was selected as the best answer