在开发人员控制台上,将错误视为静态只能用于顶级类型的方法
采用DML语句输入的静态方法
public class InvoiceHandler { public static APEX_Invoice__c insertNewinvoice(今天的日期){ 列表invoiceList = [SELECT id,Name,APEX_Status__c,createdDate FROM APEX_Invoice__c WHERE createdDate = today]; return invoiceList; } } 此方法采用名称日期参数并生成新发票。它将返回该invoiceList。
如果我只在下面执行 列出invoiceList = [SELECT id,Name,APEX_Status__c,createdDate FROM APEX_Invoice__c WHERE createdDate = today];
代码已成功执行,但我的意图是通过类和静态方法执行
答案 0 :(得分:-1)
如果您正确缩进代码会有所帮助..
public class InvoiceHandler
{
public static List<APEX_Invoice__c> insertNewinvoice(date today)
{
List<APEX_Invoice__c> invoiceList = [SELECT id, Name, APEX_Status__c, createdDate FROM APEX_Invoice__c WHERE createdDate = today];
return invoiceList;
}
}