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.
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.
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:
subscriberId = :UserInfo.
SELECT parentId FROM EntitySubscription WHERE subscriberId = :UserInfo.getUserId() AND parent.RecordType='Account' OR parent.RecordType='Contact'