4

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?

1 Answer 1

3

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

<apex:repeat value="{!Followers}" var="f">
    $("#myDiv").append('{!f.Parent.Name}');
</apex:repeat>
2
  • Cheers Dunc44! That worked perfectly! I spent hours trying to figure that out.
    – Daft
    Commented Oct 10, 2013 at 8:19
  • Glad to here it. No prob Commented Oct 10, 2013 at 12:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .