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
Kalpana DhanajayarajKalpana Dhanajayaraj 

Error: Compile Error: Method does not exist or incorrect signature: CaseUtil.validateCase(List<Case>)

Method :  public static void validateCase(Case[] cases){
     for(Case c: cases){
      if((c.recordTypeid == Label.RT_Deal_Support && c.Type == 'Insight Tag Implementation') && (String.isBlank(c.contact.Name) || c.Top_Level_Domain__c == null))
         {
            c.addError('Top-Level Domain and Contact Name are required when Record type = Deal Support and Type = Insight Tag Implementation');
         }
       }
    }


On calling the above method via trigger 
trigger CaseTrigger on Case (before insert, before update, after insert, after update, after delete, after undelete) {
    if(GeneralUtil.triggerOverrideCheck('CaseTrigger')){
        if(Trigger.isBefore){
            CaseUtil.validateCase(Trigger.new);

Getting the error Method does not exist or incorrect signature: CaseUtil.validateCase(List<Case>)

Method is defined in caseutil class
Best Answer chosen by Kalpana Dhanajayaraj
Amit Chaudhary 8Amit Chaudhary 8
Please check below point
1) validateCase method is class is in "GeneralUtil" class or "CaseUtil".
2) Please check you have any Apex class with Case Name ?
3) Try to change validateCase like below

public static void validateCase(List<case> cases){
     for(Case c: cases){
      if((c.recordTypeid == Label.RT_Deal_Support && c.Type == 'Insight Tag Implementation') && (String.isBlank(c.contact.Name) || c.Top_Level_Domain__c == null))
         {
            c.addError('Top-Level Domain and Contact Name are required when Record type = Deal Support and Type = Insight Tag Implementation');
         }
       }
    }

Let us know if this will help you

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please check below point
1) validateCase method is class is in "GeneralUtil" class or "CaseUtil".
2) Please check you have any Apex class with Case Name ?
3) Try to change validateCase like below

public static void validateCase(List<case> cases){
     for(Case c: cases){
      if((c.recordTypeid == Label.RT_Deal_Support && c.Type == 'Insight Tag Implementation') && (String.isBlank(c.contact.Name) || c.Top_Level_Domain__c == null))
         {
            c.addError('Top-Level Domain and Contact Name are required when Record type = Deal Support and Type = Insight Tag Implementation');
         }
       }
    }

Let us know if this will help you
This was selected as the best answer
Kalpana DhanajayarajKalpana Dhanajayaraj
Thanks It worked.
Also I created a case of record type 'Deal Support'  and Type = Insight Tag Implementation.
And did not enter value for Contact name and Top-level domain.
But the error was not thrown.

validateCase method is class is present in CaseUtil class.