I have a trigger where I'm calling a method from handler class and I'm passing the trigger.New to that method like this:
if(Trigger.isBefore && Trigger.isInsert){
List<Lead> lstLead = Trigger.New;
LeadHandler.assignLeadsToQueue(lstLead);
}
But Now I have a requirement where I want to pass another dynamic string value to that method in the apex class like this:
public static void assignLeadsToQueue(List<Lead> lstLead, String queueName){
List<Group> lstQueue = [SELECT Id FROM Group WHERE type='Queue' AND Name LIKE : queueName];
List<GroupMember> grpList = [SELECT UserOrGroupId FROM GroupMember WHERE GroupId IN : lstQueue];
List<AggregateResult> userIdWithLeadCountList = [SELECT OwnerId, Status, COUNT(Id) leadCount FROM Lead WHERE ((OwnerId IN (SELECT UserOrGroupId FROM GroupMember WHERE GroupId IN : lstQueue)) AND (Status = 'Open - Not Contacted' OR Status = 'Working - Contacted')) GROUP BY OwnerId, Status ORDER BY COUNT(Id)];
**Another Logic with List<Lead> lstLead, List<GroupMember> grpList and List<AggregateResult> userIdWithLeadCountList**
}
The String queueName is coming from the LWC.
Now, I'm facing issue in passing the value because the trigger shown the error if I do not add String parameter to the method. (We cannot pass the parameter directly to trigger via LWC)
How can I do that