function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Harjeet Singh 13Harjeet Singh 13 

How to send a notification/alert/email when certain threshold of Daily Async Apex Execution reaches

Dear All,

I want to send an alert notification when overall organisation Async Apex Execution limit reached 70%of total limit(24hrs API Limit). Say if limit is 2500 and if system already exhausted 1750 of daily Async Apex Limit out of 2500 then any alert should be send to few persons notifying that your organisation limit of Async Apex Executions have reached 70% threshold.

I have done few research on the same but didn't get anything concrete. I saw blogs/documentation stating about Limit class and Limit methods but those are having limit method for future but no where I get any thing related to Async Apex Exceution Limits. In Limit Class I saw there are 2 mthods 'getAsyncCalls()' and 'getLimitAsyncCalls()' but both are related reserved for future use.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_limits.htm#apex_System_limits_getAsyncCalls
Kindly help me.

Any help will be greatly appreciated.

Many thanks in advance

Thanks & Regards,
Harjeet
Vinod ChoudharyVinod Choudhary

Hi Harjeet,

Try following : 

     Log-in to Salesforce.

    Go to Setup -> Manage Users -> Users.

    Click on edit before the user who should receive the emails.

    Select the Send Apex Warning Emails option and save.

Thanks
Vinod

Harjeet Singh 13Harjeet Singh 13
Dear Vinod, 

Thanks for your response. Acfually I am already aware about the same. What you are suggesting will come handy when an user for which Send Warning Email checkbox enabled is executing Apex then only that user receives a notification. 
But my requirement is different.My requiremnt states that an alert/notification needs to be send to couple of folks when Daily limit of Async Apex Execution (24hrs API limit) which is 250000API calls per day reaches 70% threshold irrespective of any user who executes apex. 
 
Your suggestion suggests notification will receive only to those user who is executing apex and also Send Email Alert checkbox is enabled for that user.

Kindly let me know if you need more info/clarifications on my question. 

Kindly help me. 

Many thanks in advance

Thanks & Regards,
Harjeet
Ahmed SefraouiAhmed Sefraoui
Hi Harjeet,

I'm also working for the same issue. In my case i want to send a notification if the Flex Queue is surpassing the 50% limit, but I didn't find any related information. Did you find any solution to this problem?

Thanks in advance!