3 Replies Latest reply on Apr 30, 2017 5:45 AM by MotazAlqaissi

# Calculate response breach time and due date to auto populate user demand list

The customer would like to identify trends, specifically if certain departments submit service requests with unrealistic due dates.  It has been identified that this could be achieved via a ‘User demand’ ref list but the customer would only like to implement this if the user demand list is automated:.

The idea would be that the User due date would be compared with the breach time (from response level) and auto populate a User demand attribute:

For example:

·         If User Due date is within 1.5 days of response level breach time, then User demand = Immediate

·         If User Due date is between 1.5 and 3 days of response level, then user demand = High

·         If User Due date is within 3 and 7 days of response level, then user demand = Moderate

·         If User Due date is over 7 days of response level, then user demand = Normal

My thoughts are this could be achieved via a calculation:

Due date – creation date = User breach time, response level breach time – user breach time = percentage of days as set out above.  The result sets the User priority.

If anyone has implemented anything of this kind, would appreciate some comments, suggestions or feedback.

• ###### 1. Re: Calculate response breach time and due date to auto populate user demand list

Hi Keith,

A calculation would definitely be the way to go. Below would be a rough start point. Needs testing and refining obvioulsy but should put you on the right path.

import System
static def GetAttributeValue(Incident):
UserBreachTime = ''
UserBreachTime = Incident._DueDate - Incident.CreationDate

Demand = UserBreachTime - Incident.MinutesToBreach()

if Demand.Days > 7:

Value = 'Normal'

if Demand.Days > 3:

Value = 'Moderate'

if Demand.Days > 1.5:

Value = 'High'

if Demand.Days < 1.5:

Value = 'Immediate'

return Value

• ###### 2. Re: Calculate response breach time and due date to auto populate user demand list

is there a wrong with this cal:

import System

static def GetAttributeValue(Incident):

Value= 'False'

Time = DateTime.Now - Incident.CreationDate

if Time > Incident._MinutesToBreach() :

Value = 'True'

return Value

• ###### 3. Re: Calculate response breach time and due date to auto populate user demand list

You are trying to compare a datatime value with int32 value. This will not work