Pages

Thursday, March 21, 2013

Query Chatter comment


In my previous blog, I give overview on Chatter Feed, how to query it, and how it is structured within Salesforce.

In this blog, I would like to give overview on Chatter Comment. Using any API tool, we can query and extract all feed comment into csv file. The API object name is FeedComment (record prefix with 0D7).

Sample query
Select f.Id, f.FeedItemId, f.ParentId, f.CommentType, f.CommentBody, f.RelatedRecordId, f.CreatedDate From FeedComment f

FeedItemId is Chatter feed that comment tag to, and ParentId show the comment is tag to what object, it can go to Opportunity, User, Chatter Group and etc.

As of API version 23.0 and beyond, if you have “View All Data” permission you can query FeedComment records directly without an ID filter. Using API version before 23, you will get this error:






More information on chatter comment here.

Pretty simple...?

5 comments:

  1. Is it possible to create a new field within the FeedComment object ? I would use it for mapping purposes in a data migration I am currently conducting. Thank you.

    ReplyDelete
    Replies
    1. Vincent, I do not think it is possible as the field itself is not visible under setup menu.
      But, if you familiar with Metadata API, it is worth to try, let me know the result. http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_create.htm

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Thank you for your response Johan. That is an interesting approach. I'm not sure I would really know how to go forward. I was hoping to be able to access the object through Eclipse, and to manually put a new field into the object's XML file.

    I just realized I would want to put the new field into the FeedItem object, not the FeedComment object. But it's still the same problem, because it would be for an object which I cannot access.

    What I am attempting to do is this : Due to a large data migration, I need to move feed data to new records. I am able to move FeedItem data by creating a field in the destination object which will record the original record's ID. After exporting the original data I would then map the recordID to that new field in the destination object. I could then re-export the data and have lists of the new and old record ID. That will allow me to associate the original record ID with the new record ID. With that, I can map the new record ID into the ParentID field of a FeedItem import, effectively moving the Feed data to a new record.

    I would like to do this same process with the Comments of that FeedItem. However, I cannot build a new field in the FeedItem to record the original recordID of the feed as I did in the master object.

    If you have any ideas on this I would love to hear it.

    ReplyDelete
    Replies
    1. Vincent, I think you are going to the right direction. And you may be do not need new field in FeedItem.
      Try this, once FeedItem loaded into new Salesforce.com instance, you can export it back into Ms Excel file and do VLOOKUP() to match old and new FeedItem Id, from there you can use the new ID for FeedComment. I am not 100% sure it works, but worth to try.

      Best of Luck!

      Delete

Page-level ad