Reopen tickets based on due date?

Hello list!

I am trying to set up a crib job to reopen a ticket with a status of Scheduled and a due date that is less than 8 hours away. I have a cron job running periodically throughout the day to check for this condition, and open and ticks that match.

Here’s the kicker: if seems that any time I set the ticket’s status to Scheduled, RT sets the due date of said ticket to a different date, meaning if it’s reopened on the next cron job. RT also seems to unset the due date after certain actions.

Is this expected behavior? For now, I think I can work around it by just setting the status first, due date second, but I’m wondering what other conditions might affect the due date. If Due isn’t a field I would be using, is there a better way to do this? A sample of days activity follows.

Thanks,

Peter

#
Thu Feb 23 16:15:45 2017 The RT System itself - Outgoing email recorded [Show]
#
Thu Feb 23 16:15:45 2017 The RT System itself - Starts changed from Not set to Fri Feb 24 09:00:00 2017 
#
Thu Feb 23 16:15:45 2017 The RT System itself - Due changed from Not set to Mon Feb 27 10:00:00 2017 
#
Thu Feb 23 16:24:44 2017 The RT System itself - Outgoing email recorded [Show]
#
Thu Feb 23 16:24:44 2017 The RT System itself - Status changed from 'new' to 'open' 
#
Thu Feb 23 16:24:44 2017 The RT System itself - Due changed from Mon Feb 27 10:00:00 2017 to Not set 
#
Thu Feb 23 16:28:27 2017 The RT System itself - Outgoing email recorded [Show]
#
Thu Feb 23 16:28:27 2017 The RT System itself - Due changed from Not set to Mon Feb 27 10:00:00 2017 
#
Fri Feb 24 11:02:01 2017 peter (Peter Nikolaidis) - Comments added [Reply] [Comment] [Forward]
#
Fri Feb 24 11:02:02 2017 peter (Peter Nikolaidis) - Status changed from 'open' to 'stalled' 
#
Fri Feb 24 11:02:02 2017 The RT System itself - Due changed from Mon Feb 27 10:00:00 2017 to Not set 
#
Fri Feb 24 11:02:17 2017 peter (Peter Nikolaidis) - Due changed from Not set to Mon Apr 24 00:00:00 2017 
#
Sat Feb 25 13:38:07 2017 The RT System itself - Outgoing email recorded [Show]
#
Sat Feb 25 13:38:07 2017 The RT System itself - Due changed from Mon Apr 24 00:00:00 2017 to Not set 
#
Sun Feb 26 09:02:34 2017 root (Paradigm Support) - Due changed from Not set to Sun Feb 26 00:00:00 2017 
#
Sun Feb 26 09:02:55 2017 root (Paradigm Support) - Due changed from Sun Feb 26 00:00:00 2017 to Sat Feb 25 00:00:00 2017 
#
Sun Feb 26 09:03:19 2017 root (Paradigm Support) - Status changed from 'stalled' to 'scheduled' 
#
Sun Feb 26 09:03:19 2017The RT System itself - Due changed from Sat Feb 25 00:00:00 2017 to Mon Feb 27 10:00:00 2017 
#
Sun Feb 26 09:04:53 2017root (Paradigm Support) - Due changed from Mon Feb 27 10:00:00 2017 to Sun Feb 26 00:00:00 2017 
#
Sun Feb 26 09:06:16 2017root (Paradigm Support) - Due changed from Sun Feb 26 00:00:00 2017 to Sun Feb 26 11:00:00 2017 
#
Wed Mar 01 15:42:47 2017 The RT System itself - Outgoing email recorded [Show]
#
Wed Mar 01 15:42:47 2017 The RT System itself - Due changed from Sun Feb 26 11:00:00 2017 to Not set 
Wed Mar 01 15:44:20 2017 The RT System itself - Outgoing email recorded [Show]
#
Wed Mar 01 15:44:20 2017 The RT System itself - Due changed from Not set to Fri Mar 03 09:44:19 2017 
Wed Mar 01 16:54:07 2017 The RT System itself - Outgoing email recorded [Show]
#
Wed Mar 01 16:54:07 2017 The RT System itself - Due changed from Fri Mar 03 09:44:19 2017 to Not set 

#
Wed Mar 01 17:01:39 2017 The RT System itself - Outgoing email recorded [Show]
#
Wed Mar 01 17:01:39 2017 The RT System itself - Due changed from Not set to Fri Mar 03 10:00:00 2017

Does this ticket have an SLA set? That may be what’s automatically updating the due date after certain actions.

Thanks, Shawn - you nailed it. I guess this illustrates the danger of copying and pasting sample code without understanding what it does! I modified my %ServicesAgreements setting to include my ‘scheduled’ and a couple of other statuses, and nothing has opened “magically” today.