首页 > 解决方案 > 我安排了一个顶级课程每天运行,但没有任何反应。有人可以帮帮我吗?

问题描述

我编写了这个 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;}
    }
  }
}

标签: salesforceapexapex-code

解决方案


你现在写了 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


推荐阅读