Change the creation date of a ticket


#1

Hello

My apologies in advance for what could be a dumb question… is it possible to change the ticket creation date? We are changing systems and ideally I need to set the date of one ticket to be specific to Jan 1 instead of March 5 for internal tracking purposes.

Thanks in advance.


#2

You can’t change the Created date/time from the web UI in RT, even as an Admin. However, if you’ve got command line access you can be sneaky with Perl:

#!/usr/bin/perl                                                                 

use strict;
use warnings;
use lib '/opt/rt4/lib';
use lib '/opt/rt4/etc';
use lib '/opt/rt4/local/lib';
use lib '/opt/rt4/local/etc';
use RT -init;
use RT::Ticket;
use Getopt::Long;

my $ticketId = 0;
my $dateTime = '2019-01-01 10:22:51';
GetOptions('ticketId=s' => \$ticketId,
           'date=s' => \$dateTime,
    );
die "No ticketId\n" if(!$ticketId);
my $currentUser = RT::CurrentUser->new(RT::SystemUser);

my $ticket = RT::Ticket->new($currentUser);
$ticket->Load($ticketId);

print "Initial created date: " . $ticket->Created() . "\n";
$ticket->_Set(Field => 'Created', Value => $dateTime);
print "New created date: " . $ticket->Created() . "\n";