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
salesforce_hoonigansalesforce_hoonigan 

Help with apex class to attend to my trigger call

Hi,

I am new to apex and I need assistance creating a class to attend with my trigger call.
 
trigger TargetCompletionTime on Predecessor_Task__c (before insert, before update) {
    BusinessHours stdBusinessHours = [select id from BusinessHours where Name = 'Default'];
    
    for(Predecessor_Task__c pt : trigger.new)
      {
       if((pt.Actual_Start_Date_Time__c!=null) && (pt.Alloted_Hours__c!=null)) 
         {   
            DateTime d1=BusinessHours.add(stdBusinessHours.Id, pt.Actual_Start_Date_Time__c,
            integer.valueOf(pt.Alloted_Hours__c * 60 * 60 * 1000));
            pt.Target_Completion_Date_Time__c=d1;
         }
         
      }
}

 
pconpcon
What do you mean by "attend with my trigger call"?  Are you refering to a class to test your trigger?