Vote 30  points

Ryan Ausanka-Crues

Be able to query EntitySubscription entries of a single record type

Salesforce Platform, Apex & Visualforce, Applications, Integration, Salesforce Chatter

User Story:
As a chatter developer I would like to be able to write a single query that retrieves entries from EntitySubscription that are only of a certain record type so that I can easily display a subset of the records a user is following without having to write inefficient iteration logic.

Problem:

I would like to be able to retrieve just subscriptions of contacts or accounts from EntitySubscription but currently there is no way to do that. I tried:

SELECT parentId FROM EntitySubscription WHERE subscriberId = :UserInfo.getUserId() AND parentId LIKE '001%' OR parentId LIKE '003%'


But this fails with "invalid operator on id field" because you cannot use like with Id fields.

Possible Solution:

Since "Parent.name" is being programmatically generated, maybe it would be possible to add "Parent.IdPrefix" or "Parent.RecordType" to the parent mapping so that I could write something like:

SELECT parentId FROM EntitySubscription WHERE subscriberId = :UserInfo.getUserId() AND parent.IdPrefix='001' OR parent.IdPrefix='003'

or

SELECT parentId FROM EntitySubscription WHERE subscriberId = :UserInfo.getUserId() AND parent.RecordType='Account' OR parent.RecordType='Contact'

 

4 years ago · 4 Comments ·Merge Idea · Report Abuse

1 to 4 of 4

Ideas

Apps

Questions

Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



 

 

Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce.com takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


 

Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.