I have my simple trigger working now where once a threshold is met for cases created within 60 minutes it updates the "SendAlert" field so my workflow can start going to work.
The next steps I am trying to figure out is if it is possible to only have this occur during non-business hours?
trigger OutageAlert on Case (before insert) {
date today =system.today();
List<Case> numberofcases = [SELECT ID FROM CASE where SLA__c<=:1];
for(case cas:trigger.new){
if(cas.origin == 'Web - Email'){
if(numberofcases.size() == 5) {
cas.SendAlert__c = true;
}
if(numberofcases.size() == 10) {
cas.SendAlert__c = true;
}
}
}
}
How can I add a function into this where it will only run during non-business hours?
Clarification: I want the field SendAlert__c to not go active while in business hours, is this possible in a workflow maybe since its not possible in the trigger?