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.

function calculateBusinessDays(valEscalationDays)
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); 
		var dayofweek=datetoday.getDay();
			if(dayofweek == 6.0)

return finalEscalationDays.toString();

Hope that helps!

Simran Jeet Singh

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Leave a Reply

Leave a Comment

  • geoffc says:

    I like this! Now how about a way to handle holidays? Maybe define a structure where you can identify the days of the year that are holidays? Then every country would have to define their own values for that structure?

    Managing dates suck!

By: sjeet
Aug 31, 2011
4:11 pm
Active Directory Authentication Automation Cloud Computing Cloud Security Configuration Customizing Data Breach DirXML Drivers End User Management Identity Manager Importing-Exporting / ICE/ LDIF Intelligent Workload Management IT Security Knowledge Depot LDAP Monitoring Open Enterprise Server Passwords Reporting Secure Access Supported Troubleshooting Workflow