Due date based on priority
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I am trying to get the due date in the catalog tasks to autopopulate depending on the priority. I have managed to make it work however, this should make the due date only dates that are M-F and exclude holidays. This is what I have so far but is not working any suggestions?
(function executeRule(current, previous /*null when async*/ ) {
if (current.operation() != 'insert' && !current.priority.changes())
return;
var p = current.priority.toString();
var hours;
if (p === '1') hours = 6;
else if (p === '2') hours = 12;
else if (p === '3') hours = 36; //1 day + 12h
else if (p === '4') hours = 60; //2 days + 12h
else hours = 96; //4 days
var sched = new GlideSchedule();
sched.load('9edeb2281b314910d7a3a687624bcb9b');
var start = new GlideDateTime();
var durationMs = hours * 60 * 60 * 1000;
var due = sched.add(start, durationMs);
current.setValue('due_date', due);
})(current, previous);
0 REPLIES 0