Im using the following code to return the list of users that I am following in Chatter. I am following 4 users.

    List<EntitySubscription> followers;

    followers = [
      SELECT Id, ParentId, Subscriber.Name, Parent.Name
      FROM EntitySubscription WHERE SubscriberId = :userId

    public List<EntitySubscription> getFollowers() {
       return followers;

and then in my JS I put it in a div.

$("#myDiv").html('{! Followers}');

At the moment, all that displays is the following:

[0E8R0000000SD6KAM, 0E8R000000008DEAY, 0E8R00000004FZWE5, 0E8R000000008eVG1Q]

How do I get the user names to display instead of these numbers?


You can use an apex:repeat tag to accomplish this. You can use apex repeat tags within scripts.

<apex:repeat value="{!Followers}" var="f">
| improve this answer | |
  • Cheers Dunc44! That worked perfectly! I spent hours trying to figure that out. – Daft Oct 10 '13 at 8:19
  • Glad to here it. No prob – Chris Duncombe Oct 10 '13 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.