Tuesday, August 14, 2012

Creating Chatter Pulse history



The Chatter Pulse AppExchange plug-In for Salesforce Chatter only starts collecting history at the time of installation. Chatter Pulse does not retroactively create history; however, we can populate Chatter Pulse history using the APEX Data Loader.

This post discusses one possible way of creating history, based on Chatter Posts and Comments created prior to the installation of Chatter Pulse being.
Fig 1: Chatter Pulse History, prior to import

Preparation:

Download and Install APEX Data Loader if not already installed. It is important to point out that the Chatter API changed in the Summer ’12 release, therefore you should use APEX Data Loader, version 25 or later.
Creating FeedItem History:

1. Launch APEX Data Loader

2. Click Export, then enter the user name and password for your Salesforce Org

3. By default, only Salesforce’s core objects will display. In order to see everything, including Chatter objects, click the “Show all Salesforce objects” option. Doing so will display a host of new objects including FeedItem and FeedComment.

4. Select Feed Item (FeedItem), chose a target file location and name such as c:\extracts\FeedItemHist.csv, then click Next

5. Select the fields: ParentId, Type, CreatedById, and CreatedDate, and add a filter to exclude any system generated Chatter (Type not equals ‘TrackedChange’) and click Finish
Note: For larger Orgs, you may also want to add a date filter to exclude history that is over 6 months old.

6. Review the resulting file to check for any abnormalities.

7. Go back to Data Loader in order to load the resulting CSV file (from FeedItem) into Chatter Pulse (CP_Chatter_Pulse__c)

8. Click Insert, Log In to your org and click Next

9. Select the object Chatter Pulse (CP_Chatter_Pulse__c), making certain not to confuse this with Chatter Pulse - Groups, and click Next

10. The system will tell you how many records exist in your import, Click OK

11. Click Create or Edit Map and map your fields as follows:

  • CREATEDBYID – Chatter_User__c
  • CREATEDDATE – Reporting_Date__c
  • PARENTID – Related_Record__c
  • TYPE – Update_Type_c


12. Click OK, the click Next
13. Choose a directory for errors and success files and click Next
14. Click Finish

Creating FeedItem History:

The structure of FeedItem and FeedComment are very similar, basically we will not repeat steps 1-14, this time using FeedComment as opposed to FeedItem

1. Extract the fields ParentId, CreatedById, CreatedDate, and CommentType from the  FeedComment object. No need to do any filtering on Type this time around, SFDC does not create any auto-comments. However, again, you may wish to filter comments based on date in larger orgs.

2. When inserting the records into the Chatter Pulse object, the field mapping is slightly different (TYPE vs COMMENTTYPE):

  • COMMENTTYPE – Update_Type_c
  • CREATEDBYID – Chatter_User__c
  • CREATEDDATE – Reporting_Date__c
  • PARENTID – Related_Record__c


VoilĂ ! You now have history in Chatter Pulse!

Fig 2: How's that for growth!