-2

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
New contributor
user116670 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
12
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Jun 23 at 14:41
  • To add more to the comment above, this problem statement does not make a ton of sense with the context given. Please provide additional information such as how you are trying to delete the code, where you are seeing the error, etc. There shouldn't even be a compile step when you delete a class/trigger.
    – Adrian Larson
    Jun 23 at 15:02
  • I've tried all the methods mentioned here: help.salesforce.com/s/articleView?id=000327373&type=1 via ANT Migration, Salesforce CLI, Change Sets and Workbench. I amended the SampleAccountTrigger.trigger-meta.xml (this is the actual trigger I want to remove) file by changing the Status to Deleted and then deploy it into the production. But it gives back the same error message in the terminal and in Workbench.
    – user116670
    Jun 23 at 15:22
  • the error message received on Workbench is 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
    – user116670
    Jun 23 at 15:22
  • Can you try commenting out this code 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.
    – arut
    Jun 23 at 15:27

0

Your Answer

user116670 is a new contributor. Be nice, and check out our Code of Conduct.

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

Browse other questions tagged or ask your own question.