You need to sign in to do that
Don't have an account?
Jay Iiladhar
Apex trigger issue
I am recieving the following error when saving a lead record - Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger Lead caused an unexpected exception, contact your administrator: Lead: execution of BeforeInsert caused by: line 7, column 4: trigger body is invalid and failed recompilation: Method does not exist or incorrect signature: LeadTriggerHandler.TriggerBeforeInsert(List)
I cant seem to find the source of the issue - any ideas?
Review all error messages below to correct your data.
Apex trigger Lead caused an unexpected exception, contact your administrator: Lead: execution of BeforeInsert caused by: line 7, column 4: trigger body is invalid and failed recompilation: Method does not exist or incorrect signature: LeadTriggerHandler.TriggerBeforeInsert(List)
I cant seem to find the source of the issue - any ideas?
Ok so I far I can see. You have a class that will be call from the trigger. But right now the class its commeted out.
You need to uncomment your "LeadTriggerHandler" class and so the trigger can see the method "TriggerBeforeInsert".
1) Trigger named lead should have a line like this:
2) The class LeadTriggerHandler should a method call TriggerBeforeInsert, that right not its commented, just remove the comments "//" save the class and then save the trigger and it should work.
I will suggest to start by removing the comments form the methods defintion, so at least the trigger will be able to complie, then you can comple you work in the class.
Lest me know how it goes.
Regards,
Bill
All Answers
Can you plese share the code ? Seems to be an issue in the line 7, either the method does no exist or there is an issue with the parameters of that method. If you share the code I might be able to help you.
public class LeadTriggerHandler
{
//public static void TriggerBeforeInsert (List<Lead> lLeads)
{
//List<Lead> lPostalSectorsToInsert = new List<Lead>();
//for (Lead lead : lLeads)
{
// if (lead.Country == 'UK' || lead.Country =='CA')
{
// lPostalSectorsToInsert.add(lead);
}
}
// if (lPostalSectorsToInsert.size() > 0)
{
// LeadUtil.assignPostalSector(lPostalSectorsToInsert);
}
}
// public static void TriggerBeforeUpdate (List<Lead> lNewLeads, Map<Id, Lead> mapOldLeads)
{
// List<Lead> lPostalSectorsToUpdate = new List<Lead>();
// for (Lead lead : lNewLeads)
{
// if (((lead.Country == 'UK' || lead.Country =='CA') && !lead.PostalCode.equals(mapOldLeads.get(lead.Id).PostalCode)) || ((lead.Country == 'UK' || lead.Country =='CA') && lead.PostalCode.equals(mapOldLeads.get(lead.Id).PostalCode)))
{
// lPostalSectorsToUpdate.add(lead);
}
// else if (lead.Country!=mapOldLeads.get(lead.id).Country
// && (lead.Country != 'UK' || lead.Country !='CA'))
{
// lead.Territory_Postal_Sector__c = null;
}
}
// if (lPostalSectorsToUpdate.size() > 0)
{
// LeadUtil.assignPostalSector(lPostalSectorsToUpdate);
}
}
}
Ok so I far I can see. You have a class that will be call from the trigger. But right now the class its commeted out.
You need to uncomment your "LeadTriggerHandler" class and so the trigger can see the method "TriggerBeforeInsert".
1) Trigger named lead should have a line like this:
2) The class LeadTriggerHandler should a method call TriggerBeforeInsert, that right not its commented, just remove the comments "//" save the class and then save the trigger and it should work.
I will suggest to start by removing the comments form the methods defintion, so at least the trigger will be able to complie, then you can comple you work in the class.
Lest me know how it goes.
Regards,
Bill
Sure I can try to help you with that. But I am sure people in the community will be also glad to help, therefore I suggest you to create a new post with details about what you want to accomplish, what issues are you having, code and structure you have so far.
Regards,
Bill