0

I have a class with a method from which I want to make an instance but on saving the instance method I get the error:

Method does not exist or incorrect signature: void getInstance() from the type FahCreator

I am expecting to do :

FAHCreator.getInstance().generateAndInsertFARecords(scope, 'string');

Apex

public void execute(Database.BatchableContext info, List<sObject> scope){
    FAHCreator.getInstance().generateAndInsertFARecords(scope);
}



public map<id,string> generateAndInsertFARecords(List<sObject> records, string source){
    system.debug('FAHCreator: generateAndInsertFARecords() '+ source + ' ' + string.valueOf(records.size()));
    map<id,string> result = new map<id,string>();
 ..
  • What is the definition of the class FAHCreator? You have to have a static method that takes those parameters. – David Reed Apr 10 at 13:59
2

FAHCreator apparently doesn't have a getInstance() method. You should add it to that class:

public class FAHCreator {
  static final FAHCreator instance = new FAHCreator();
  public static FAHCreator getInstance() {
    return instance;
  }
  // Other code
}

From there, you still need to make sure that you're using two paramters on generateAndInsertFARecords (your Apex example shows only one parameter).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.