function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mahmoud Coudsi 1Mahmoud Coudsi 1 

Error: Compile Error: Method does not exist or incorrect signature: void runEligibilityCheck() from the type Eligibility at line 4 column 15

What i'm trying to achive:

Simply call a class from a trigger when checkbox is checked and lead record is saved.

Error message:

Error: Compile Error: Method does not exist or incorrect signature: void runEligibilityCheck() from the type Eligibility at line 4 column 15
 
// My Class

global with sharing class Eligibility {
// Code here
    
      private static String runEligibilityCheck(String patientID) {
      // More code in my method

     }

}
// My Trigger.
Trigger CheckEligiblityUponSelfSchedule on Lead (before update, before insert) {
  for (Lead l: Trigger.new) {
  if(l.self_scheduled__c = TRUE){
  Eligibility.runEligibilityCheck();
    }
  }
}
PawanKumarPawanKumar
you just change private to public. then it will work.

// My Class

global with sharing class Eligibility {
// Code here
    
      public static String runEligibilityCheck(String patientID) {
      // More code in my method

     }

}


Additionally, You pass parameter to runEligibilityCheck in trigger.

// My Trigger.
Trigger CheckEligiblityUponSelfSchedule on Lead (before update, before insert) {
  for (Lead l: Trigger.new) {
  if(l.self_scheduled__c = TRUE){
  Eligibility.runEligibilityCheck(l.Id);
    }
  }
}

Please mark it best if it helps you. Thanks.