Find your content:

Search form

You are here

How to get Chatter limits in apex?


There is currently a limit that a single user can only follow 500 entities on Chatter. This is very low for a Social Enterprise, in my opinion, and I figure that it will have to get increased once the "social" part of the Enterprise goes more mainstream.

I have some apex that sets a user to automatically follow a record when they take a certain action. I have a component that I include in my VF page that displays an informational page message to the user when they are near the limit so that they know that when they take that action they will not be set to automatically follow it unless they unfollow other things first.

I currently have the 500 entity subscription limit in a Custom Setting, but I don't want to have to remember to constantly check to see if/when the 500 gets increased. Someone else might be maintaining it, etc.

I know that there is the Limits class and I've used that before to get info on SOQL queries, but I don't see anything on this Limit, or anything like a general purpose getLimit('nameOfLimit') method.

How can I get the 500 entity subscription limit programmatically or if there isn't a way, is there something better than the stashing the 500 in a Custom Setting?

Attribution to: Peter Knolle

Possible Suggestion/Solution #1

There is no way to get this limit programmatically which is a bit of an issue since this is a soft limit that salesforce can raise for you (the highest I've gotten it is 2500).

A custom setting is the best way I've found to store this but hopefully someone will chime in with a better solution.

Attribution to: Greg Grinberg
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content