0
votes

i'm trying to write an apex class that checks a chekbox, on a custom object when a specific Date is less than 30 days from todays date. The class is supposed to run once a week to constantly check for Records that are supposed to be updated. I have absolutely no knowledge in Apex and my code is made up from various snippeds that I found in other Threads. I think I almost got it, but it keeps showing this error message: Method does not exist or incorrect signature: void DateCheck() from the type CustomersDateCheck.

Can somebody help me out here?

global class CustomersDateCheck implements Schedulable {
global void execute(SchedulableContext sc) {
DateCheck();}

public static void DateCheck(Customers__c[] objects){


for(Customers__c obj: objects){
        if(obj.DateField > Date.today()){
            continue;
        }
        else{
        obj.FlowUpdateHelper__c = true;

        }
    }
}

}

Thanks in advance!

2

2 Answers

0
votes

please pass the parameter in the function call that you are calling inside the execute method. DateCheck(pass parameter)

0
votes

Pass the List by query to customer object to fetch the required records.

e.g.

global void execute(SchedulableContext sc) {

List<Customers__c> customersList = [SELECT Id FROM Customers__c];
DateCheck();

}

OR

global void execute(SchedulableContext sc) {

Customers__c[] customersList = [SELECT Id FROM Customers__c];
DateCheck(customersList);

}