Can anyone tell me how to get the organization Chatter id? My usecase is: I wanna get the chatter feeds of user that I followed. So that I can add comments,likes for that feed.. For this I have created a visualforce page:

public class VFC06_ChatterFollow{

public list<User> userList {get;set;}

public VFC06_ChatterFollow(){
    userList = [select id, lastname, firstname, profile.Name, profile.Usertype from user
                    where isactive = true
                    and profile.Usertype = 'Standard'
                    and id != :UserInfo.getUserId()];



Thanks in advance Karthick

2 Answers 2


I presume you mean to ask how you get the id of Chatter users (not the org) that you are following. You can do so with the following approach

// Everyone you're following
EntitySubscription[] followingES = [select id, parentid, subscriberid, parent.name 
                                    from EntitySubscription
                                    where subscriberid =:uid];//Set to the User's Id

List<EntitySubscription> following = new List<EntitySubscription> ();
String userSObjectPrefix =  User.sObjectType.getDescribe().getKeyPrefix();
for( EntitySubscription es: followingES )
      if( ('' + es.parentid).substring(0,3) == 
                        userSObjectPrefix) // users only
Integer followingUserCount = following.size();
  • I wanna feeds of user That I followed on Visualforce Page Oct 29, 2014 at 6:02
  • For That how Can I create visualforce Page Oct 29, 2014 at 6:03

Use the classes/methods in the Apex ConnectApi namespace: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_connect_api.htm

For info about which methods to call to get feeds, scroll down to "Getting feed elements from a feed" on this page: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_connectapi_feeds_feed_elements.htm

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.