I am researching into migration of chatter data between two instances of Salesforce. Specifically I need to migrate chatter data within Collaboration Groups in a Community. I found all the posts from within the groups within the FeedItem table, including the related "answers", which really are just records in FeedComment table. What I cannot find is the relationship which makes the FeedItem records appear under a specific CollaborationGroup.

I looked through every relationship on FeedItem, and cannot find how it is linked to specific CollaborationGroup. I took one FeedItem as an example, it appears under one of the CollaborationGroup records, but its ParentId refers to a User record, RelatedRecordId refers to a ContentDocument record, InsertedById refers to user record, CreatedById refers to User record. I don't see any junction objects either, which link that post (FeedItem) to the CollaborationGroup record.

Does anyone know how to identify the child FeedItem records of type QuestionPost in a given CollaborationGroup record?

  • 1
    The relationship would be ParentId. Did they get brought into the group via @mention?
    – Adrian Larson
    Dec 5 '16 at 16:47
  • As I mentioned in my post, the FeedItem's ParentId field contains reference to the User record, not the CollaborationGroup record. I don't see a direct reference of the FeedItem record to CollaborationGroup record, yet the FeedItem appears under that specific group. The FeedItem record was created by posting a question into the CollaborationGroup, e.g. not via @mention.
    – Ordos
    Dec 5 '16 at 17:12
  • Actually, I read more about mention, and it seems like this may be exactly what is happening here, the post was created by a given user directly and then the group was simply mentioned. So, while the post is directly related to the creating user (ParentId contains user ID), the mention puts the post in the group's feed. I will need to verify this by extracting the mentions somehow. Thanks @AdrianLarson
    – Ordos
    Dec 5 '16 at 17:22

There is an object called CollaborationGroupFeed which has a field called parentId. ParentId field belongs to the collaborationGroup and id of collaborationGroupFeed belongs to the feed id. You also have a field called type which gives us whether it is QuestionPost or AdvancedTextPost or any other type.

so your query would be something like

select id, type, parentId from CollaborationGroupFeed where type='QuestionPost'

will give you feeds of questionpost

For more details please go through usage part of this link --https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_collaborationgroup.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.