You need to sign in to do that
Don't have an account?
thekid12345
how to call an APEX class method from a Trigger
In my Class I have this method
Method does not exist or incorrect signature
global class Queue{ public static void send(List<ListRequests> requests){...} }In my Trigger, I initialize the class and want to call the Apex class method
Queue sendToQueue = new Queue(); List<String> lead = new List<String>(); sendToQueue.send(leads);It is throwing an error saying
Method does not exist or incorrect signature
I am not sure what you are trying to do, here r few errors noted below.
global class Queue{
public static void send(List<ListRequests> requests){...} // Method signature looking for a list of type 'ListRequests'
}
Queue sendToQueue = new Queue();
List<String> lead = new List<String>(); // Here you have defined list of type 'String' which is supposed to be 'ListRequests' as per your method signature
sendToQueue.send(leads); //you have mispelled the parameter name as 'leads' but you have defined it as 'lead' - 's' at the end.
Please fix all the issues.
Please mark it as solved if it helps you to fix the issues.
Thanks.
I would also like to add one more point.
You have declared your send method as a static method, hence you need not instatiate the class and then call the send method. Instead you can direclty call it as -
change to