+ Start a Discussion
Luik LaraLuik Lara 

Receiving Error: Compile Error: Invalid type: ActivityUtils at line 8 column 5

Hi! I am very new to triggers and can not figure out what is wrong with this. I am receiving this error: Error: Compile Error: Invalid type: ActivityUtils at line 8 column 5 when trying to add a trigger to the task object that will allow my custom field (on the lead) to count how many closed tasks there are.

trigger NVMTaskTrigger on Task (after insert, after update, after delete, after undelete) {
    
    sObject[] triggerRecords;
    if(!trigger.isDelete) triggerRecords = trigger.new;
    else triggerRecords = trigger.old;
    
    //Update Open Activity Count
    ActivityUtils au = new ActivityUtils(triggerRecords);
    au.updateAccountActivityCount();
    au.updateContactActivityCount();
    au.updateLeadActivityCount();
    au.updateOpportunityActivityCount();
    au.updateCaseActivityCount();
}
AbhinavAbhinav (Salesforce Developers) 
Hi Luik,

Why you are using ActivityUtils type?