Skip to main content
I'm trying to summarize some time with a trigger in a case but I'm worried about the performance.

trigger DispatchingTrigger on Case (before update) {

    for(Case c_new: Trigger.New)

    {

        for(Case c_old: Trigger.Old)

        {

            if(c_old.Status == 'Work in Progress' && c_old.Dispatch_Completed__c == false) {

                if (c_new.Dispatching_Time_c == null) c_new.Dispatching_Time_c = 0;

                c_new.Dispatching_Time__c += ((Datetime.now().getTime() - c_old.LastModifiedDate.getTime()) * 0.000016666666667);

            }

        }

    }

}

Is there any other location to add this logic?
3 Antworten
0/9000