salesforce - 我安排了一个顶级课程每天运行,但没有任何反应。有人可以帮帮我吗?
问题描述
我编写了这个 APEX 课程并安排它每天运行。我没有收到错误消息,但不幸的是该课程没有做任何事情......有人可以帮助我吗?
global class CustomersDateCheck implements Schedulable {
global void execute(SchedulableContext sc) {
List<Customers__c> CustomerList = [SELECT Id FROM Customers__c];
DateCheck(CustomerList);}
public static void DateCheck(Customers__c[] objects){
for(Customers__c obj: objects){
if(obj.DateField > Date.today()){
continue;}
else{obj.FlowUpdateHelper__c = true;}
}
}
}
解决方案
你现在写了 Schedulable,你需要调度它。
在开发人员控制台中运行这 3 行代码,然后检查 apex 作业
//will run daily at 13:00
CustomersDateCheck m = new CustomersDateCheck();
String sch = '0 0 13 * * ?';
String jobID = system.schedule('Customers Date Check Job', sch, m);
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_scheduler.htm
推荐阅读
- django - 从 django 模板获取多个单选按钮值
- python - Django表单文本字段不显示
- javascript - 在 Shopify 商店中嵌入 Vue 组件
- python - 写错时程序不打印“用户名或密码错误”
- laravel - Laravel 连续运行 artisan 命令
- fortran - 在 Fortran 中对变量的所有位值求和的有效方法
- matplotlib - Matplolib 修复 pdf 文件的确切大小
- firebase - 如何在 Firebase 安全规则中使用通配符
- java - 我如何计算查询/数据快照?
- javascript - 一个 addEventListener 似乎被另一个停用