如何解决 Flow 调用顶点类的 Salesforce 流错误

问题描述

我有一个调用 apex 类的流,这里是执行日志错误,如何解决错误

流“ServiceAppointment_API”期间发生错误:发生 Apex 错误:System.AsyncException:

Warning: Approaching hourly email limit for this flow.
Each flow in your organization is limited to 100 error emails per hour. Since 12:00 PM,Salesforce has sent 99 error emails for ServiceAppointment_API flow. After 100 emails,Salesforce suppresses all error emails for this flow. The limit resets at 1:00 PM.
Error element myWaitEvent_myWait_myRule_3_event_0_SA1 (FlowActionCall).
An Apex error occurred: System.AsyncException: You've exceeded the limit of 100 jobs in the flex queue for org 00D36000000rhGR.
 Wait for some of your batch jobs to finish before adding more. To monitor and reorder jobs,use the Apex Flex Queue page in Setup.

感谢您的帮助

问候, 卡罗琳

解决方法

apex 类会安排一些异步(后台)处理。可能是批处理作业,可能是用@future 注释的方法或称为队列能力的东西。在给定时间,您最多可以提交 100 个,并且最多可以有 5 个处于活动状态(正在运行)。

不看代码很难说如何修复。

也许不需要@future,开发人员本意很好,但出了点问题。也许它必须是异步的,但可以通过基于时间的工作流或流程构建器中的计划操作来完成? 也许这是您的错误,该代码可以重写以更快地工作或一次处理超过 1 条记录。 也许这不是您的错,也许有一个托管包安排了大量作业,但下一个作业未能提交。 也许您需要考虑重写以将其分离,但更多。与其说是即时处理,不如说是让代码每 5 分钟运行一次,检查最近是否有更改需要处理并执行。