Salesforce 致命错误| System.DmlException:删除失败。第0行的第一个异常

Salesforce 致命错误| System.DmlException:删除失败。第0行的第一个异常,salesforce,apex-code,soql,Salesforce,Apex Code,Soql,我有一个带有代码的批处理类 公共类BatchDeleteEvents实现Database.Batchable、Database.Stateful、Database.AllowsCallout{ private String query; private String pageToken ; private String CalendarId; private String accessToken; public BatchDeleteEvents(String CalendarId, Strin

我有一个带有代码的批处理类

公共类BatchDeleteEvents实现Database.Batchable、Database.Stateful、Database.AllowsCallout{

private String query;
private String pageToken ;
private String CalendarId;
private String accessToken;
public BatchDeleteEvents(String CalendarId, String accessToken){

    this.query = 'Select Id, Name from Event__c'; // Query to get the CalendardID (Google ID)
this.CalendarId =CalendarId;
this.accessToken =accessToken;
}

public Database.Querylocator start(Database.BatchableContext BC){

    return Database.getQueryLocator(query);

}

public void execute(Database.BatchableContext BC, List<sObject> scope){
System.debug('Entered in delete Batch');
for(Event__c c : (List<Event__c>)scope)
 GCalendarUtil.doApiCall(null,'DELETE','https://www.googleapis.com/calendar/v3/calendars/'+CalendarId+'/events/'+c.name,accessToken);


    delete scope;
    }
public void finish(Database.BatchableContext BC){   
  for(CalendarSettings__c c: [Select Id, Name, CalendarId__c,CalendarQuery__c,FieldToDisplay__c from CalendarSettings__c])
     {  BatchPublicCampaignsToGoogle bjob = new BatchPublicCampaignsToGoogle(c.CalendarQuery__c,c.CalendarId__c,c.FieldToDisplay__c);
        Database.executeBatch(bjob,9); // This is set to process 9 records, allowing 1 extra callout for refresh token in case needed.
    }
    }

    }

这里没有我正在使用delete命令的地方为什么我会遇到这个错误任何人请帮助???

也许你删除了for循环中的所有作用域将其更改为

for(Event__c c : (List<Event__c>)scope){
  GCalendarUtil.doApiCall(null,'DELETE','https://www.googleapis.com/calendar/v3/calendars/'+Cal   endarId+'/events/'+c.name,accessToken);

 }
 delete scope;
(事件(列表)范围)的
{
GCalendarUtil.doapcall(null,'DELETE','https://www.googleapis.com/calendar/v3/calendars/“+Cal endandra+”/events/'+c.name,accessToken);
}
删除范围;

也许您删除了for循环中的所有作用域,并将其更改为

for(Event__c c : (List<Event__c>)scope){
  GCalendarUtil.doApiCall(null,'DELETE','https://www.googleapis.com/calendar/v3/calendars/'+Cal   endarId+'/events/'+c.name,accessToken);

 }
 delete scope;
(事件(列表)范围)的
{
GCalendarUtil.doapcall(null,'DELETE','https://www.googleapis.com/calendar/v3/calendars/“+Cal endandra+”/events/'+c.name,accessToken);
}
删除范围;

Hi All I have same problem.你能单击此链接查看日志I a have same problem.嗨All I have same problem.你能单击此链接查看日志I a have same problem。