0

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 Answers2

0

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

Ranbir Das
  • 501
  • 4
  • 9
0

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);

}

  • Sorry for my late reply and thank you for your answer. I implemeted the code and i don't get an error message anymore. I sheduled the APEX class to run everyday, but unfortunately it doesn't work. – Tim Dammann May 25 '20 at 12:11
  • I opened another thread with my code, because the character limit on the comment field was too small: https://stackoverflow.com/questions/62002277/i-sheduled-an-apex-class-to-run-everyday-but-nothing-happens-can-somebody-help – Tim Dammann May 25 '20 at 12:20