function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Becky Miller 15Becky Miller 15 

Constructor Not Defined - Trigger Issue

 trigger QueueTrigger on Sales_Product_Category__c (after insert, after update, after delete) {
   
    CustomTriggerSwitch__c ct = CustomTriggerSwitch__c.getValues('salescategory');
    
    if(ct == null || ct.Active__c || Sales_Product_Category__c.business_plan__c <> null || 
      Sales_Product_Category__c.ID <> null){ 
           
     
        List<Sales_Product_Category__c> salescategory = (Trigger.isDelete ? Trigger.old : Trigger.new);

        System.enqueueJob(new QuotaProductQueueable(salescategory,Trigger.oldMap));
}

}


The error is bolded :  Constructor not defined: [QuotaProductQueueable].<Constructor>(List<Sales_Product_Category__c>, Map<Id,Sales_Product_Category__c>)

What am I missing? 

 
Best Answer chosen by Becky Miller 15
Jason HardyJason Hardy
The issue is not with your trigger per sey, it's due to the QuotaProductQueueable class. Basically, you're attempting to pass in a list and a map. Salesforce is telling you that you do not have a constcutor setup for those particular types. Meaning it should have something like this defined in the QuotaProductQueueable class:
public QuotaProductQueueable(List<Sales_Product_Category__c> listVar, Map<Id,Sales_Product_Category__c> mapVar) {
	//Constcutor code goes here
}
 By defaul this is the only constcutor defined (even if it's not present in your code, SFDC does it automatically):
public QuotaProductQueueable() {
	//Constcutor code goes here
}
If you don't want to modify the QuotaProductQueueable class, then all you need to do is create a variable and queue it up
QuotaProductQueueable qpq = new QuotaProductQueueable();
qpq.propertyForList = salescategory;
qpq.propertyForMap = trigger.oldMap;
System.enqueueJob(qpq);