function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MillikMillik 

list of users the current user is not following

I want a list of user that current user in not following in chatter , please help me I am new in this developer arena...

 

I got the list of cureent user's following

 

Select id, subscriberid  from entitysubscription where Subscriberid= "Userinfo.getuserid();

 

Regards,

Millik

souvik9086souvik9086

If you got the list of current user's following, then what is the problem in getting the list that current user is not following. There you can check like

 

Select id, subscriberid  from entitysubscription where Subscriberid != "Userinfo.getuserid();

MillikMillik

No that will not work, it's give only those record who is subscribed by someone or you, if someone or no one is following that user so it won't come...

 

 

JPClark3JPClark3

Wish it was simpler:

 

list<entitysubscription> entitites = [Select id, subscriberid, ParentID 
                                      from entitysubscription 
                                      where Subscriberid = :Userinfo.getuserid()];
list<ID> ParentIDs = new list<ID>();
for(entitysubscription sub : entitites)
    ParentIDs.Add(sub.ParentID);
list<User> NonFollowedUsers = [Select id, Name
                                      from User 
                                      where ID NOT IN :ParentIDs];