You need to sign in to do that
Don't have an account?
Kalpana 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
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
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
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
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.