A couple of posts recently in the Yahoo MagicSolutions forum made me realise that there was no easy way of checking if a given datetime was during or outside working hours (as defined by the work schedule). Consequently I set about writing a UDF that would accept a work schedule name and datetime as an input and return 1 if the time fell within the given work schedule and 0 if it did not.
Because of the way things get formatted using WordPress I have saved the function as a text document available here: IsWorkTime Function
Depending on where you want to use UDF’s in Service Desk Express you need certain permissions to do so. Personally, whenever I create a function like this (assuming it is not returning any privaleged information) I grant execute permissions to everyone. To do this simply run the following SQL:
GRANT EXECUTE ON [_SMDBA_].[IsWorkTime] TO Public
In my next post I’ll discuss how to use UDF’s in business rules…