Beräkna kontorstider i triggrar:

Dessa metoder är möjliggör tidsberäkningar där man tar hänsyn till de Kontorstider som är inställda för aktuellt ärende. All tid där ärendet är satt med status Vilande och/eller Stängt att exkluderas.

 

// calculate deadline 2 hours after created date, within business hours:

var aDeadline = api.CalculateDate(record, record.CreatedDate, 120);

 

// calculate time passed between ticket’s registered & closed dates:

record.u_Duration = api.CalculateDuration(record, record.CreatedDate, record.CloseDateTime);

 

// check whether ticket registered inside/outside business hours, assign to field

record.u_CreatedInBusinessHours = api.IsInsideBusinessHours(record, record.CreatedDate);

 

// check whether time right now is within business hours

var openRightNow = api.IsInsideBusinessHours(record, DateTime.UtcNow);