I am having a class which has future annotation and I am calling that apex class through a trigger then trigger is giving me below error.
"Method does not exist or incorrect signature: void relatedtows(Id) from the type RelatedTowtoContact"
My Class:
public class RelatedTowtoContact {
@future(callout =true)
public static void relatedtows(List<Id> alltows123){
List<Related_TOW__c> allrelatedtows = [select Id, Name, Lead__c, Contact__c,Tow_Id__c from Related_TOW__c where Id IN: alltows123];
set<Id> contactid = new set<Id>();
set<Id> leadId = new set<Id>();
for(Related_TOW__c tow: allrelatedtows){
//------------------------------------------//
if(tow.Lead__c != NULL){
//if(tow.Contact__c != null){
leadId.add(tow.Lead__c);
//}
//}
system.debug('contactId is :' + contactid);
Map<Id, Lead> leadMap = new Map<Id,Lead>([select Id, Related_TOW_IDs__c from Lead where Id IN : leadId]);
List<Lead> updatelead = new List<Lead>();
system.debug('leadMap is :' + leadMap);
for(Related_TOW__c t : allrelatedtows){
if(leadMap.get(t.Lead__c).Related_TOW_IDs__c == null){
leadMap.get(t.Lead__c).Related_TOW_IDs__c = t.Tow_Id__c;
system.debug('related tow is : ' + leadMap.get(t.Lead__c).Related_TOW_IDs__c);
}
else{
leadMap.get(t.Lead__c).Related_TOW_IDs__c = leadMap.get(t.Lead__c).Related_TOW_IDs__c + ';' + t.Tow_Id__c;
}
// updatecon.add(conMap);
}
update leadMap.values();
}
Trigger:
trigger TowIdtoContact on Related_TOW__c (After insert, After Update) {
for(Related_TOW__c tow: trigger.new){
RelatedTowtoContact.relatedtows(tow.Id);
}
}