Wednesday, January 22, 2014

How to mass follow user or record in Chatter?

I blog about how to query records followed by users in Chatter last year. I get another requirement recently, if it is possible to mass follow users to a record or user. YES, it is possible. We can use the same way as my previous blog above for this purpose.

Use Data Loader to create new records in EntitySubscription object.

Only 2 fields you need to put in the CSV file:
1. ParentId : user / record to follow
2. SubscriberId : follower

You can use the same way to mass un-follow, this is the same with mass delete records in EntitySubscription object, but make sure you prepare the data correctly in CSV file, you just need to provide EntitySubscription Id.

Note: one user only can follow maximum of 500 records (include users), see this document. But, you can request Salesforce support to increase this limit.

Reference from Salesforce help - Can I subscribe users to follow a record in Chatter using the Apex Data Loader?