【发布时间】:2020-07-13 09:54:57
【问题描述】:
我有一个简单的批处理,全局变量为:
global with sharing class sampleBatchApex implements Database.Batchable<sObject>{
global List<Case> myList;
global Database.QueryLocator start(Database.BatchableContext BC){
}
global void execute(Database.BatchableContext BC, List<sObject> scope){
//some stuff;
}
global void finish(Database.BatchableContext BC){
myList = SELECT ID ... FROM ...
}
}
还有一个我试图得到myList的地方
public class BatchApexProgressIndicatorController {
public static sampleBatchApex myBatchObject = new sampleBatchApex();
批处理以其他方法执行,我正在监视作业。完成后,我将调用以下方法来获取 myList
@AuraEnabled
public static List<Case> getCases(){
return myBatchObject.myList;
}
}
它让我得到一个空列表。
但是,如果我在批处理的完成方法中 System.debug 列表,我可以看到该列表不为空。
能否请您提示我如何从其他班级获得此列表?
谢谢
【问题讨论】:
标签: salesforce apex