Is there any way to Chatter Feed Tracking programatically for a field which is long / rich datatype in salesforce.com?

I tried to do this using salesforce standard way but was not able to get the old and new value in chatter using set history tracking button.

But for normal fields , i am getting new/old value in chatter.

I came to know that the chatter standard way doesnot give old and new value for fields with characters more than 256 .

Can some let me know how this can be achieved.

Best regards, Ankita

  • Can someone help me on this?? Commented Sep 2, 2015 at 9:04

2 Answers 2


Thank you guys for your help.I was able to achieve something like this.Posting the answer as it might help others also.

  list<FeedItem> lstFeedItem = new  list<FeedItem>();
for(account acc : trigger.new ){
    if(acc.Tracking_Field__c != trigger.oldMap.get(acc.Id).Tracking_Field__c ){
        FeedItem objFeedItem = new FeedItem();
        objFeedItem.ParentId = acc.Id;
        objFeedItem.Body = 'changed Tracking field from '+ trigger.oldMap.get(acc.Id).Tracking_Field__c +' to '+ acc.Tracking_Field__c ;
        objFeedItem.Type = 'TextPost';
        objFeedItem.NetworkScope = 'AllNetworks';


insert lstFeedItem;


  • 1
    Thanks for sharing that! To make your code more robust, you should take the maximum length of FeedItem.Body into account. It's currently 10,000 characters. If you try to set the Body larger than that, your trigger will throw an exception when it tries to insert the list of feed items.
    – alouie
    Commented Sep 10, 2015 at 6:30

There's no way to configure Chatter to display the old and new values for Long Text Areas and Rich Text Areas. The automatically generated "feed tracked change" post will only indicate that the value was updated.

You'd need to write an Apex trigger to post a feed item containing the old and new values. It's not possible to format it like the automatically generated posts, though.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .