• saurav nirala 1
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
first class: 
global class FGContactOwnerUpdate1 implements Database.Batchable<sObject> {
List<Contact> Con = new List<Contact>();
List<Contact> ConList = new List<Contact>(); //Contact List to update
 
global FGContactOwnerUpdate1(List<Account> AccList){
        List<id> AccListId = new List<id>();
        for(Account ac: AccList){ 
        AccListId.add(ac.id);
    }
    } 
    
global static Database.QueryLocator start(Database.BatchableContext BC){
 string Con = 'select id, OwnerId, Account.ownerId from Contact where AccountId in :AccListId and Active__c = true';
    return Database.getQueryLocator(Con);
}  
    
   global void execute(Database.BatchableContext BC, List<Contact> conlist){
       for(Contact c: conlist){
    if(c.OwnerId != c.Account.OwnerId){
    c.OwnerId = c.Account.OwnerId;
     ConList.add(c); 
   }

Database.update(ConList);
}
}
    global void finish(Database.BatchableContext BC) {
  }
}

second class :
global class FGContactOwnerUpdate {
    
@InvocableMethod(label='exuete the batch ContactBatch' description='This method will be execute ContactBatch')
global static void executeBatchMethod(List<String> lst) {
    FGContactOwnerUpdate1 c1= new FGContactOwnerUpdate1();
    Database.executeBatch(c1, 50);
  }
    
}

Getting error as : Constructor not defined: [FGContactOwnerUpdate1].<Constructor>().

Its an urgent issue