Same day / Next day deadline



In stead of creating a priority that creates a deadline within x hours, I would like to have a deadline that is calculated on the end of the day or eind of next day.

How can I approach this? Is it possible to overwrite the deadline calculated by the priority, based on my own calculation?


Thanx in advance!


RE: Same day / Next day deadline

Hi Niels,

I would create an event handler "Request changed priority" where you calculate the date and set a new deadline.

Something like this

Integer ticketId = getVariable("ticketId").toInteger();

Ticket t;

WeekSchedule ws;

DateTime dt;
Integer weekDay = dt.getWeekDay();

String timeStop;
if(weekDay == 0)
  timeStop = ws.getMonStop().toString();
else if(weekDay == 1)
  timeStop = ws.getTueStop().toString();
else if(weekDay == 2)
  timeStop = ws.getWedStop().toString();
else if(weekDay == 3)
  timeStop = ws.getThuStop().toString();
else if(weekDay == 4)
  timeStop = ws.getFriStop().toString();
else if(weekDay == 5)
  timeStop = ws.getSatStop().toString();
else if(weekDay == 6)
  timeStop = ws.getSunStop().toString();

t.setValue("deadline", dt.toString().before(" ") + " " + timestop);;

Of course, I'd test this code first, but atleast you'd be able to change the deadline to the end of the current day. You can also change the code a little to load the date of the current deadline, and just change the time till the end of office hours.

Av: Simen Mostuen Iversen 6. sep 2017