Pages

Sunday, August 4, 2013

Salesforce: Enable Feed Tracking versus Set History Tracking

A few months back, I wrote a blog on Chatter feed item and the structure, that blog explains on "Feed Tracking" and the data structure. When selected fields are enabled for feed tracking, any changes to those fields will be shown in the record Feed. You can find this feed at top of page layout,

If user change value of more than 1 field in one update, it will be captured into only one feed (no matter how many fields are changed).



You can hide feed by click "Hide Feed" link or click "Fewer Updates" in Show: to show only feed created manually (Feed automatically created by Feed Tracking will not shown).

Feed Tracking is stored in an object, end with suffix Feed (for a Standard object) or __Feed (for a Custom object). If you dig further, records created by feed tracking will have API Type = TrackedChange, for other Type:
  • ContentPost - an uploaded file on a feed
  • LinkPost - a URL posting on a feed
  • PollPost - a poll posted on a feed
  • TextPost - a direct text entry on a feed
You also can find the exact same value in the FeedItem object (with API version 23.0 or later).
SELECT Id, CreatedDate, CreatedById, CreatedBy.FirstName, CreatedBy.LastName, ParentId, Type, Parent.Name, Body,
(SELECT ID, FieldName, OldValue, NewValue FROM FeedTrackedChanges ORDER BY ID DESC)
FROM FeedItem
WHERE CreatedDate > LAST_MONTH
ORDER BY CreatedDate DESC

From the above query, you can see FeedTrackedChange is linked to the FeedItem object (using FeedItemId field) and use to store field name, old and new value. FeedTrackedChange object starts with prefix 0D6 and FeedItem start with prefix 0D5. 


While for Set History Tracking from the object level, it has almost the same function with feed tracking to track field change, but it stored in the different object and for the different purpose:

1. Record end with prefix History (for a Standard object) or __History (for a Custom object).

2. Every field change will have its own record in history object and directly linked to the ParentId.

3. The user can easily run History report to display values change related to the object.



No comments:

Post a Comment

Page-level ad