I'm trying to delete a trigger (a simple task) but for some reason, I keep receiving the following error no matter how I delete/amend the trigger.
Constructor not defined: [GenerateGLpostingBatch].<Constructor>()
How can I resolve this error message?
The below is the apex class where the error is occurring.
Would really appreciate any assistance on this.
FYI this apex class is not actually being used (it was part of a cancelled project) but same error occurs when I try to delete it.
/*******************************************************************************************
* @Name TMSACRUNCtrl
* @Author *****
* @Date 13/5/2021
* @Group GL POsting Services
* @Description This class contains all service methods related to GL Postings.
*
*******************************************************************************************/
public with sharing class TMSACRUNCtrl {
/**************************************************************************************
* @Name generateGLpostings
* @Description This method create the GL Posting records.
* @Arguments List of TMS ACRUN extract records.
* @Return None
**************************************************************************************/
public static void generateGLpostings(List<TMS_ACRUN_Extract__c> TMSACRUNExtracts){
String sendToEmail='anushri.bhargava@apptituda.com';
// String sendToEmail='arunk@apptituda.com';
try{
Set<String> glCodeIDs=new Set<String>();
String glCodeStr='';
for(TMS_ACRUN_Extract__c tmsAcrun: TMSACRUNExtracts){
GL_Postings__c glPosting=new GL_Postings__c();
String[] glPostingStr=tmsAcrun.ACRUN_Lines__c.split(',');
if((String.isNotBlank(glPostingStr.get(3)))&&(glPostingStr.get(3)!='0.00')){
glCodeIDs.add(glPostingStr.get(0));
}
}
System.debug('glCodeIDs ----- '+glCodeIDs);
Set<String> glCodesStaticCoa=new Set<String>();
List<Static_COA__c> staticCOAs=[SELECT Nostro__c,AS_GL_Code__c,TMS_Acct_No__c,AS_GL_Variable4__c,Department__c,Location__c FROM Static_COA__c WHERE TMS_Acct_No__c IN : glCodeIDs];
for(Static_COA__c staticcoa: staticCOAs){
glCodesStaticCoa.add(staticcoa.TMS_Acct_No__c);
}
System.debug('glCodesStaticCoa ----- '+glCodesStaticCoa);
Set<String> glCodeAccountMissing=new Set<String>();
for(String strCode: glCodeIDs){
if(!glCodesStaticCoa.contains(strCode))
glCodeAccountMissing.add(strCode);
}
System.debug('glCodeAccountMissing ----- '+glCodeAccountMissing);
if(glCodeAccountMissing.size()>0){
System.debug('inside if glcode missing');
String mailBody= 'Dear Sir/Madam , ';
mailBody+='GL Code '+ glCodeAccountMissing +' are Not Present in the TMS ACRUN Extracts.';
sendEmailOnGLposting(sendToEmail, 'GL Code are Not Present' , mailBody);
}else{
System.debug('inside else batch process starts ');
//batchprocess
List<ID> acrunids=new List<ID>();
for(TMS_ACRUN_Extract__c tmsAcrunExtract:TMSACRUNExtracts){
String[] glPostingStr=tmsAcrunExtract.ACRUN_Lines__c.split(',');
if((String.isNotBlank(glPostingStr.get(3)))&&(glPostingStr.get(3)!='0.00')){
acrunids.add(tmsAcrunExtract.ID);
}
}
Database.executeBatch(new GenerateGLpostingBatch(), 10);
}
}catch(Exception e){
System.debug('Exception Error message cls-TMSACRUNCtrl meth-glAccountCheck-----'+e.getMessage());
System.debug('Exception Cause cls-TMSACRUNCtrl meth-glAccountCheck-----'+e.getCause());
System.debug('Exception StackTrace cls-TMSACRUNCtrl meth-glAccountCheck-----'+e.getStackTraceString());
}
}
public static void sendEmailOnGLposting(String sendToEmail, String mailSubject, String mailBody){
Messaging.SingleEmailMessage glPostingMail=new Messaging.SingleEmailMessage();
List<String> sendTo = new List<String>();
sendTo.add(sendToEmail);
glPostingMail.setToAddresses(sendTo);
//glPostingMail.setReplyTo('anushri@sonalibank.com');
glPostingMail.setSenderDisplayName('Sonali Bank UK LIMITED');
glPostingMail.setSubject(mailSubject);
glPostingMail.setHtmlBody(mailBody);
Messaging.SingleEmailMessage[] glPostingMails = new List<Messaging.SingleEmailMessage> {glPostingMail};
Messaging.sendEmail(glPostingMails);
}
}
Many thanks
Update: When trying to delete the trigger called 'SampleAccountTrigger' the following error message is received on Workbench.
success: false
runTestResult (5)
numFailures: 2
numTestsRun: 2
totalTime: 0
failures (2)
TMSACRUNCtrl.
id: 01p4K00000DY4YRQA1
message: line 76, column 31: Constructor not defined: [GenerateGLpostingBatch].<Constructor>()
methodName:
name: TMSACRUNCtrl
namespace:
packageName: TMSACRUNCtrl
stackTrace:
time: -1
type: Class
TMSACRUNCtrlTest.
id: 01p4K00000DY4YSQA1
message: line -1, column -1: Dependent class is invalid and needs recompilation: Class TMSACRUNCtrlTest : Constructor not defined: [GenerateGLpostingBatch].<Constructor>()
methodName:
name: TMSACRUNCtrlTest
namespace:
packageName: TMSACRUNCtrlTest
stackTrace:
time: -1
type: Class
TMSACRUNCtrl. id: 01p4K00000DY4YRQA1 message: line 76, column 31: Constructor not defined: [GenerateGLpostingBatch].<Constructor>() methodName: name: TMSACRUNCtrl namespace: packageName: TMSACRUNCtrl stackTrace: type: Class TMSACRUNCtrlTest. id: 01p4K00000DY4YSQA1 message: line -1, column -1: Dependent class is invalid and needs recompilation: Class TMSACRUNCtrlTest : Constructor not defined: [GenerateGLpostingBatch].<Constructor>() methodName: name: TMSACRUNCtrlTest namespace: packageName: TMSACRUNCtrlTest type: Class
Database.executeBatch(new GenerateGLpostingBatch(), 10);
first and then delete it. It could be a dependency issue and you probably need to do the code amendment and deletion as 2 different tasks.