Schedule Jobs
- Open Salesforce’s Developer Console
- In the Debug menu, select “Open Execute Anonymous Window”:

In the Execute Anonymous Window, paste the following code, then click the “Execute” button:
System.schedule('Process App_Limit__c (Hourly :00)', '0 0 * * * ?', new applimits.ScheduleBatchProcessAppLimits());
System.schedule('Process App_Limit__c (Hourly :15)', '0 15 * * * ?', new applimits.ScheduleBatchProcessAppLimits());
System.schedule('Process App_Limit__c (Hourly :30)', '0 30 * * * ?', new applimits.ScheduleBatchProcessAppLimits());
System.schedule('Process App_Limit__c (Hourly :45)', '0 45 * * * ?', new applimits.ScheduleBatchProcessAppLimits());
Set Retention
Determine how long you want to keep App Limit records.
About 50 records are created in every quarter-hourly run, meaning that you’ll get 4,800 per day.
To customize the retention setting,
- navigate to Custom Metadata in Salesforce Setup
- click the “Manage Records” link to the left of “Batch Process App Limit Setting”:

- click the “Edit” link to the left of the RESTAPILimits record:

- in the “Delete WHERE Clause” field, set the criterion that determines when records get deleted, then save the record. It’s currently set to
Record_Age_Hours__c >= 8
. . . meaning that App Limit records will be deleted once they’re eight hours old.
This can be set to anything that can be evaluated in SOQL, like
Record_Age_Days__c >= 7
or something with fancier logic like
Record_Age_Days__c >= 3 AND
Limit_Name__c != 'DataStorageMB'
. . . if you wanted to keep all Data Storage records, plus everything less than three days old.
Go Play!
- Click the “App Limits” tab.
- Check out your new Reports and Dashboards.
- Have fun!