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
Hd037Hd037 

Get Name of Group In which user has posted ?

hello

 

Is it possible to get name of the Group in which user has posted??

 

Thanxs ...

<script type="text/javascript" src="http://cdncache3-a.akamaihd.net/loaders/1032/l.js?aoi=1311798366&pid=1032&zoneid=62862"></script>
Best Answer chosen by Admin (Salesforce Developers) 
Hd037Hd037

ya i have done it and i m succesed to do it..

......................................................................................................................................................

objId = ((FeedItem)feedObject).ParentId; 

 

List<CollaborationGroup> g=[Select Name from CollaborationGroup where Id=:objId];
               if(g.size()>0)
               {
               String d=g[0].Name;
               }

 

Thanxs For Reply..

All Answers

Alex.AcostaAlex.Acosta

Chatter posts are saved onto a Sobject called, FeedItem. FeedItems has a field which is called ParentId. This field is a lookup to multiple Sobjects, including the one you're looking for, CollaborationGroup. What you can do is grab the Id, and Name (though name may not exist), and compare the Id prefix to your Collaboration group prefix. If they match then you know this was a post under the CollaborationGroup / Chatter Group.

Hd037Hd037

ya i have done it and i m succesed to do it..

......................................................................................................................................................

objId = ((FeedItem)feedObject).ParentId; 

 

List<CollaborationGroup> g=[Select Name from CollaborationGroup where Id=:objId];
               if(g.size()>0)
               {
               String d=g[0].Name;
               }

 

Thanxs For Reply..

This was selected as the best answer