Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7421147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:21:32+00:00 2026-05-29T08:21:32+00:00

In my app I display a list of the current users. I request it

  • 0

In my app I display a list of the current users. I request it like this:

Attempt 1

List<User> Following = [SELECT Id, Name, SmallPhotoUrl 
  FROM User 
  WHERE Id IN (
      SELECT ParentId 
      FROM EntitySubscription 
      WHERE SubscriberId = :UserInfo.getUserId()) 
    AND Id != :UserInfo.getUserId() 
  LIMIT 96];

This does exactly what it’s supposed to when logged in as an admin but I found out that non-admins get an error:

Implementation restriction: EntitySubscription only allows security
evaluation for non-admin users when LIMIT is specified and at most
1000

OK, no big deal, I’ll just slap a LIMIT on there like so:

Attempt 2

List<User> Following = [SELECT Id, Name, SmallPhotoUrl 
  FROM User 
  WHERE Id IN (
      SELECT ParentId 
      FROM EntitySubscription 
      WHERE SubscriberId = :UserInfo.getUserId() 
      LIMIT 1000) 
    AND Id != :UserInfo.getUserId() 
  LIMIT 96];

Easy, right? WRONG. This gives the following:

expecting a right parentheses, found ‘LIMIT’

OK…

I then tried breaking it out like so:

Attempt 3

List<EntitySubscription> sub = [SELECT ParentId 
  FROM EntitySubscription 
  WHERE SubscriberId = :UserInfo.getUserId() 
  LIMIT 1000];
List<Id> ids = new List<Id>();
for(EntitySubscription s : sub){
    ids.add(s.ParentId);
}
List<User> Following = [SELECT Id, Name, SmallPhotoUrl 
  FROM User 
  WHERE Id IN (:ids) 
    AND Id != :UserInfo.getUserId() 
  LIMIT 96]; 

I crossed my fingers and…

Invalid bind expression type of LIST<Id> for column of type Id

Hmm, I’d seen examples where this seemed to be possible, such as on the developerforce boards, so I’m at a bit of a loss now.

So here we are. I need to select a list of user names and pictures that a particular user is following on Chatter. If there is a completely different way to go about it I’m open to it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:21:33+00:00Added an answer on May 29, 2026 at 8:21 am

    Try removing the parenthesis around the bind, i.e. change:

    WHERE Id IN (:ids) 
    

    to:

    WHERE Id IN :ids
    

    And also simplify the query by just making sure that your list of IDs doesn’t contain the current user’s ID:

    List<EntitySubscription> sub = [SELECT ParentId 
      FROM EntitySubscription 
      WHERE SubscriberId = :UserInfo.getUserId() AND ParentId != :UserInfo.getUserId()
      LIMIT 1000];
    
    Set<Id> ids = new Set<Id>();
    
    for(EntitySubscription s : sub){
        ids.add(s.ParentId);
    }
    

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to write an app that will display a list off lines from
I'm looking for an SQL client app that can display subdatasheets like the following:
How do I display users current location in my app, using google maps? I
I want to display the list of songs in current playing lists, If users
i'm branding an iphone app and the designer wants to display list items using
I have an app that display's the current time when a page opens. I
I am writing an app that requires the user's current location (lastknownlocation won't be
I am writing a simple app to enter a user into database & display
I am trying to create a simple app that displays a list of items
Does anyone know of a way to make an AIR app display over top

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.