如何创建警报以在达到阈值的一定百分比时通知用户DailyAsyncApex执行 [英] How to create an alert to notify an user when some amount % of threshold reached DailyAsyncApex Executions

查看:47
本文介绍了如何创建警报以在达到阈值的一定百分比时通知用户DailyAsyncApex执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的一个月中,有两次我们达到了异步顶点执行的每日限制.Salesforce暂时将我们的限制增加到425000,但在一周的时间内将其减少到250000.一旦达到极限,很多SF功能就会失效,这对内部员工和外部客户都产生了巨大影响.

因此,为防止将来发生这种情况,我们需要在Salesforce中创建某种警报,以监控我们日常的异步顶点方法执行情况.我们的每日上限为250000.警报将需要创建P3帮助台票证,并在达到70%阈值时通知几个用户说USER A和USER B.

请告知实现相同目标的可能方法

感谢&问候,哈吉特

解决方案

有希望的

当然,如果您对批处理作业有控制权,则可以进行排队,调度和管理. @future 调用可以在帮助对象中实现一些粗略的执行计数器,例如...如果大多数作业来自托管程序包,将不会对您有太大帮助...

还有1个主意,但它相当顽固-您应该能够从javascript进行REST API调用.因此您可以创建一个简单的VF页面(即使没有任何顶点控制器),在其上放置JS标注,每隔5分钟检查一次,如果达到阈值则执行某项操作……但这意味着IT人员必须打开此页面一直(可能是主页的一部分)...凌乱:)

On 2 occasions in the past month, we have managed to hit our daily limit on asynchronous apex executions. Salesforce temporarily increased our limit to 425000 but it will be scaled down to 250000 in a week's time. Once we reach the limit, a lot of the SF functions will fail and this has tremendously impacted both internal staff and external customers.

So to prevent this from happening in the future, we need to create some kind of alert in Salesforce to monitor our daily asynchronous apex method executions. Our maximum daily limit is 250000. The alert will need to create a P3 helpdesk ticket and notify couple of users say USER A and USER B once it reaches 70% threshold.

Kindly advise what is possible to achieve the same

Thanks & Regards, Harjeet

解决方案

There's a promising Limits method but it doesn't seem to work currently ("reserved for future use"): System.debug(Limits.getAsyncCalls() + ' / ' + Limits.getLimitAsyncCalls());

There's an idea you can upvote: https://success.salesforce.com/ideaView?id=0873A0000003VIFQA2 ;)

You could query SELECT COUNT() FROM AsyncApexJob WHERE ... but that sounds like a bad idea ;)

I think your best course of action is to use SF REST API. There's a "limits" resource you can fetch. You could do it from SF itself (bad idea because if you'd schedule it to run every hour then well, of course it will contribute to the limit consumption too ;)) or from some external app that'd connect to your SF...

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_limits.htm

You can quickly try it out for example in workbench.developerforce.com before you decide you do want to deep dive into coding it.

Of course if you have control over your batch jobs, queuable, schedulable & @future calls you could implement some rough counter of executions in a helper object for example... won't help you much if most of the jobs are coming from managed packages though...

Got 1 more idea but it's pretty hardcore - you should be able to make a REST API call from javascript. so you could create a simple VF page (even without any apex controller), put JS callout on it, have it check every 5 mins and do something if threshold is hit... But that means IT person would have to have this page open all the time (perhaps as a home page component)... Messy :)

这篇关于如何创建警报以在达到阈值的一定百分比时通知用户DailyAsyncApex执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆