Coming Soon to Boostr: Viewing Other Org Limits

Have you ever wondered what your daily email limit is and how many emails can still be sent? Ever wanted it to show on the System Overview page in setup? Yea me too… so … I added another enhancement to Boostr for Salesforce that shows that and all the other Org limits on the system overview page that are returned via the Limits REST API.  This is coming in the next Boostr release… Stay tuned.

Technical Bits

High-Level Algorithm

  1. When on the system overview page, grab the current user’s session id from their Salesforce cookie. This is needed because the Salesforce APIs only allow an authorized user to make API calls.
  2. Using the session id, make a callout to the Limits REST API at /services/data/v40.0/limits/
  3. If successful and the limits are returned, show the limits on the system overview in a new “Other Org Limits” section that looks and feels like the other limit sections.

Full Code

Wanna see the full code? View the Pull Request.

Inspiration

Not so long ago, Matt Addy asked how to find out what the Saleforce daily email limit is on Slackforce. We basically said that has always been a tricky question to answer because the formula Salesforce uses is complicated and there’s neither an easy way to find out using the Apex Limits object nor through the Salesforce setup area either.

The Limits object has a getEmailInvocations method and a getLimitsEmailInvocations method but those tell the currently executing code how many emails have been sent in this context and how many are still allowed. At the time of this writing, 10 emails can be sent programmatically per execution context.

After some more digging, it turns out that the Limits REST API returns the number of daily emails limit and how many are remaining along with many other limits.

Have a feature you’d like to have in Boostr? Submit a feature request issue in GitHub and a contributor may implement it. Or you can implement it yourself by following the Contribution instructions.

Related Posts

Boostr Posts

Leave a Reply

Your email address will not be published. Required fields are marked *