I just came across a scenario and thought of sharing this solution with you all.
Usually, we set escalations while designing a workflow but never think of situation where escalation is for two days and request goes for approval on Friday. In such a scenario we often end up escalating the request by Monday which is incorrect.
I have written an ECMA Script code that can be used to evaluate escalation considering Business Days. You may include this in Mapping activity of a workflow and then use it in Approval activity to set escalation days.
var datetoday = new Date();
var evalYear = datetoday.getFullYear();
var evalMonth = datetoday.getMonth();
var evalDate = datetoday.getDate();
var evalHrs = datetoday.getHours();
var evalMins = datetoday.getMinutes();
var evalSecs = datetoday.getSeconds();
var evalMs = datetoday.getMilliseconds();
var initialEscalationDays = valEscalationDays;
var finalEscalationDays = valEscalationDays;
var counter = 1;
for(counter = 1; counter <= initialEscalationDays; counter++)
var chkDate = evalDate + counter;
var datetoday = new Date(evalYear, evalMonth, chkDate, evalHrs, evalMins,evalSecs, evalMs);
if(dayofweek == 6.0)
Hope that helps!
Simran Jeet Singh
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.