function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hemmhemm 

Purge chatter feed

I was wondering how I would go about deleting Chatter Feed data.  In an org of a client where auto-follow is on, it auto-followed way too many records and now the feed is unusable and takes up a lot of space.

 

Curious if there's a way to delete the Chatter feed records.  According the to API, I am seeing objects as selectable and deletable, but when I try through the System Log, I get errors that those objects don't support that.

 

How can I go about running a quick System Log script to delete Chatter feed records?

Best Answer chosen by Admin (Salesforce Developers) 
hemmhemm

Figured it out. You have to query up each object's feed and delete those.  Example on leads.

 

 

list<leadfeed> l = new list<leadfeed>();
for (leadfeed lf : [select id from leadfeed limit 1000]){
l.add(lf);
}
delete l;

 

 

All Answers

hemmhemm

Figured it out. You have to query up each object's feed and delete those.  Example on leads.

 

 

list<leadfeed> l = new list<leadfeed>();
for (leadfeed lf : [select id from leadfeed limit 1000]){
l.add(lf);
}
delete l;

 

 

This was selected as the best answer
jrotensteinjrotenstein

Mmm, I tried running the sample code above, but I got an error that I couldn't use the "LeadFeed" object.

 

Has anybody else had success purging Chatter feed records?

jrotensteinjrotenstein

Aha! I figured it out.

 

Chatter needs to be turned on in Customize/Chatter/Settings. This will then make objects like AccountFeed and OpportunityFeed available to the System Log and Data Loader.

 

Now I've just got to get rid of my 16 million records!

jrotensteinjrotenstein

An alternative method is to use the Data Loader with the Bulk API to extract and then delete records. This works extremely fast and is great if you've got millions of records to delete!

 

A full write-up on the process can be found at: http://theenforcer.net/2010/11/too-much-chatter/