我对Account对象有如下触发器:
trigger triggerCounter on Account (before insert) {
/* this trigger is used to record the number of times trigger is called for a bunch of records */
/*countTriggerExecution.count =countTriggerExecution.count+1;
System.debug('Trigger has run' +countTriggerExecution.count);*/
}和下面的类:
public class countTriggerExecution{
/* this class provides a static counter to count the numver of times a trigger is executes */
public static Integer count=0;
}当通过工作台上传800个帐户记录,并且没有检查“通过批量API异步处理记录”时,我在调试日志中得到了4个条目,并且可以看到静态变量的值没有在这4个日志中维护。但是,当我选中'Process records via Bulk API异步‘时,只有一条触发器调试日志记录,而且静态变量的状态也会得到维护。
谁能帮助理解为什么在第一种情况下,4调试日志记录和静态变量的状态没有维护?
发布于 2017-07-03 14:37:34
Bulk api使用最多10,000条记录的批处理大小,而其他api将您的批处理分解为最多200条记录,并分别发送它们进行处理,因此这将显示为4个单独的进程。批量api将整个批次发送到服务器,然后在此之后处理记录。有关bulk api及其工作原理的更多信息,请参阅https://developer.salesforce.com/page/Loading_Large_Data_Sets_with_the_Force.com_Bulk_API。
https://stackoverflow.com/questions/44869351
复制相似问题