Improved LogEntry__c Formula Fields for Limits
For each transaction limit returned in the Limits class, LogEntry__c
has 3 fields: "limit name" used, "limit name" max, and a "limit name" formula field that shows "Used / Max". This is helpful for quickly checking how much of each limit has been consumed. However, for some limits with a large max value (such as Heap Size), the formula field does not format the numbers (which is apparently quite difficult to do in a formula field), so you end up with values like "12425 / 6000000" which can sometimes be hard to read at glance, it makes it hard to tell what percentage of the limit has been consumed, as shown in this screenshot:
To help with this, 2 changes have been made to all of the limits formula fields on LogEntry__c
:
- Added a flag indicator based on the percent of the limit used, using somewhat arbitrary-but-sensible ranges:
- 90% or more of a limit consumed: a red flag is displayed
- 80-90% of a limit consumed: a yellow flag is displayed
- Less than 80%: a green flag is displayed
- Added percentage calculation based on the limit used: to make it easier at a glance to know how much of a limit has been consumed, each field now displays the percent used in parenthesis
With these changes in place, the limits are now much easier to understand at a glance - the colored flags help indicate if there are any limits to be worried about (red & yellow flags), and the percentage calculation tells you exactly how close you are to a particular limit: