Setting Workflow Escalation in terms of Business Days



By: sjeet

August 31, 2011 4:11 pm

Reads: 232

Comments:1

Rating:0

Hi,

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)
			{
			finalEscalationDays++;
			finalEscalationDays++;
			}
	}

return finalEscalationDays.toString();
}

Hope that helps!

Regards,
Simran Jeet Singh

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags:
Categories: Identity Manager, Technical Solutions

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.

1 Comment

  1. By:geoffc

    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!

Comment