我正在从另一个批处理类的完成方法调用批处理类并面临上述错误
方法代码:
public class BatchPublicCampaignsToGoogle
implements Database.Batchable<SObject>, Database.Stateful,
Database.AllowsCallouts {
public void finish(Database.BatchableContext BC){
if(newBatch == true) {
CalendarSettings__c c =
[Select Id, Name, CalendarId__c,
CalendarQuery__c,FieldToDisplay__c
from CalendarSettings__c
WHERE Name = 'Internal marketing Calendar' LIMIT 1] ;
BatchPublicCampaign bjob = new BatchPublicCampaign();
Database.executeBatch(bjob);
}
}
}
但我收到以下错误:
Database.executeBatch cannot be called from a batch or future method.
完成批处理请求后,我试图再次调用它(我必须调用它两次)。所以我称之为。
我该如何解决这个错误?