+ Start a Discussion
tmbarrytmbarry 

Error: Compile Error: Method does not exist or incorrect signature: TriggerHandlerTask()

I am trying to create a trigger that calls a class to update a Task.  

My Class is:
public class TriggerHandlerTask {
    
    public TriggerHandlerTask(){}
    public void UpdateTaskType(Task[] newTasks){
    
     for (Task t1 : NewTasks){    
            /* 
            Developer     : Todd Barry
            Created       : 
            Last Modified : 05/18/2015
            Test Class    : 
            Objective     : When a PSS or COS BCC's to salesforce, this will ensure the correct Activity Type is set
            */
// Only update the task type if a type value has not already been selected 
If (t1.type==null){
        if(t1.subject.contains('email') || t1.subject.contains('Email')){
        t1.type='Email';}
          
    if(t1.subject.contains('meet') || t1.subject.contains('Meet')){
        t1.type='Meeting';  }
        
        else if(t1.subject.contains('visit')|| t1.subject.contains('Visit'))
        t1.type='Office Visit';   
        
        if(t1.subject.contains('call') || t1.subject.contains('Call'))
        t1.type='Phone Call';
        
        else if(t1.subject!= null)
        t1.type='Other';
}

// This update is for emails BCC to salesforce.
if(t1.subject.contains('email:') || t1.subject.contains('Email:')){
        t1.Activity_type_01__c='Email';}
        
}
                   
    }}

And my Trigger is:
trigger UpdateTaskType on Task (before insert, before Update) {

If(Trigger.isBefore){
    if(Trigger.isInsert){
        TriggerHandlerTask Handler = TriggerHandlerTask();
        Handler.UpdateTaskType(Trigger.new);
    }
    If(Trigger.isUpdate){
    }
}    
Else If(Trigger.isAfter){
    if(Trigger.isInsert){
    }
    If(Trigger.isUpdate){
    }
}
}
But i keep getting this error:  Error: Compile Error: Method does not exist or incorrect signature: TriggerHandlerTask() at line 6 column 38

What am I missing?
Best Answer chosen by tmbarry
SlashApex (Luis Luciani)SlashApex (Luis Luciani)
Hi tmbarry,

Online 5 of your trigger, make sure it reads like this (note the keyword "new"): TriggerHandlerTask Handler = new TriggerHandlerTask();

Good luck!

All Answers

SlashApex (Luis Luciani)SlashApex (Luis Luciani)
Hi tmbarry,

Online 5 of your trigger, make sure it reads like this (note the keyword "new"): TriggerHandlerTask Handler = new TriggerHandlerTask();

Good luck!
This was selected as the best answer
tmbarrytmbarry
Thanks Luis!  I always miss the simple things.