Sharing: IntervalCalculation for escalations

General question about the package, problems, solutions
jeffhans
Posts: 4
Joined: Sun Mar 01, 2009 2:13 pm

Sharing: IntervalCalculation for escalations

Postby jeffhans » Thu Mar 05, 2009 1:16 pm

Pavel,

I would like to share a small function I wrote to help with determining when to send an escalation notification.

Best Regards,

Jeff

====================================================

udb_property Name: IntervalCalculation

Value:
{
# Input parameters (input_date, Wait_Period)

my $interval;
my ($input_date) = $_[0];
my ($Wait_Period) = $_[1];

# Default is 7 days if no wait period value is passed in
if ($Wait_Period eq "") {
$Wait_Period = 7;
}

# Returns an integer value (i.e. 1) at each full $Wait_Period interval. Returns a fractional value (i.e. 1.7) otherwise.
# Parse for the decimal point to determine if a $Wait_Period has been reached.
$interval=DateTimeDiff(GetDate(),DateTimeToDate($input_date),'d')/$Wait_Period;
return $interval;
}


================================

Example Email Rule:

RULE NAME:
Defect_Escalation

RECORD TYPE:
Defect

CONDITION:
IntervalCalculation($Submit_Date)!~/\./

TO:
$Owner.email

SUBJECT:
ESCALATION: This Defect record $ID was submitted DateTimeDiff(GetDate(),DateTimeToDate($Submit_Date),'d') days ago

BODY:
Please review this record to see if any follow up is required:
ID: $ID
State: $State
Headline: $Headline

Submit Date: DateTimeToDate($Submit_Date)
Today's Date: GetDate()

Return to “Email Notification Package Q&A”

Who is online

Users browsing this forum: No registered users and 1 guest

cron