方法不存在或签名不正确Database.executeBatch

时间:2020-09-05 13:30:44

标签: salesforce

我正在寻求帮助,以弄清为什么它不起作用。

我必须在项目上更改APEX类名称。我修复了所有错误,但只有一个。

list_to_return = []
counter = 0
for item in doc_list:
  if item.contains(word):
    list_to_return.append(counter)
  counter += 1
return list_to_return

我不理解该错误,因为唯一更改的是类名。

功能出错

Error: Compile Error: Method does not exist or incorrect signature: void executeBatch(OriginalOpportunityAdSourceBatch, Integer) from the type Database at line 38 column 18

正在调用的类

public PageReference runAllOpps(){

        Database.executeBatch(new OriginalOpportunityAdSourceBatch(),batchSize);

        PageReference pr = new PageReference('/'+opp.id);
        pr.setRedirect(true);
        return pr;
    }

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

您创建的类具有start / execute / finish方法,但是您可以随时更改它们。您需要“承诺”他们永远存在的Salesforce。

您忘记将implements Database.Batchable<sObject>添加到类声明中。修复它,然后使用该类的代码应编译。