I am attempting use the following code to update the Resolved date in a ticket. Thanks for the help in advance.
package RT::Action::CSRUpdateResolvedTest;
use base ‘RT::Action’;
use strict;
use warnings;
sub Prepare
{
return 1;
}
sub Commit
{
my %mon2num = qw(
jan 1 feb 2 mar 3 apr 4 may 5 jun 6
jul 7 aug 8 sep 9 oct 10 nov 11 dec 12
);
my $self = shift;
my $ticket = $self->TicketObj;
my $datecreated = $ticket->CreatedObj->Unix;
my $dateupdated = $ticket->LastUpdatedObj->Unix;
my $datecreatedstr = $ticket->CreatedObj->AsString;
my $dateupdatedstr = $ticket->LastUpdatedObj->AsString;
my $dateresolved;
my $dateresolvedstr;
my @dateresolvedstr;
my $transactions = $ticket->Transactions;
$transactions->Limit( FIELD => ‘Type’, VALUE => ‘Status’, FIELD => ‘NewValue’, VALUE => ‘closed’);
while (my $transaction = $transactions->Next)
{
$dateresolved = localtime($transaction->CreatedObj->Unix); @dateresolvedstr = split(" ",$dateresolved);
$dateresolvedstr = $dateresolvedstr[4] . “-” . $mon2num{lc substr($dateresolvedstr[1], 0, 3)} . “-” . $dateresolvedstr[2] . " " . $dateresolvedstr[3];
}
The dates printed to the console are correct but when I view the ticket the resolved date is different than the dates printed to the console by 6 hours. This seems to me to be the off set for the time zone. What do I need to add for Request Tracker to take the date as is?
The dates printed to the console are correct but when I view the ticket the resolved date is different than the dates printed to the console by 6 hours. This seems to me to be the off set for the time zone. What do I need to add for Request Tracker to take the date as is?
Hi Byron,
AFAIK RT provides it’s own offset when printing dates/times in the UI so one must store the date/time as UTC. What is printed on the console should actually be UTC. Date/Time entered by users or stored in any way need to be converted to UTC first.
The dates printed to the console are correct but when I view the ticket the resolved date is different than the dates printed to the console by 6 hours. This seems to me to be the off set for the time zone. What do I need to add for Request Tracker to take the date as is?
Hi Byron,
AFAIK RT provides it’s own offset when printing dates/times in the UI so one must store the date/time as UTC. What is printed on the console should actually be UTC. Date/Time entered by users or stored in any way need to be converted to UTC first.
Landon Stewart : lstewart@iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité http://iweb.com : +1 (888) 909-4932
as far as I understand you script you try to set the ticket resolved
date to the transaction date when the ticket status is set to closed.
If you have configured you RT correct this is done automatically by RT.
So what is your intent with this script?
ChrisAm 19.11.2014 um 20:18 schrieb Bryon Baker:
I am attempting use the following code to update the Resolved date in a
ticket. Thanks for the help in advance.
package RT::Action::CSRUpdateResolvedTest;
use base ‘RT::Action’;
use strict;
use warnings;
sub Prepare
{
return 1;
}
sub Commit
{
my %mon2num = qw(
jan 1 feb 2 mar 3 apr 4 may 5 jun 6
jul 7 aug 8 sep 9 oct 10 nov 11 dec 12
);
my $self = shift;
my $ticket = $self->TicketObj;
my $datecreated = $ticket->CreatedObj->Unix;
my $dateupdated = $ticket->LastUpdatedObj->Unix;
my $datecreatedstr = $ticket->CreatedObj->AsString;
my $dateupdatedstr = $ticket->LastUpdatedObj->AsString;
my $dateresolved;
my $dateresolvedstr;
my @dateresolvedstr;
my $transactions = $ticket->Transactions;
$transactions->Limit( FIELD => 'Type', VALUE =>
‘Status’, FIELD => ‘NewValue’, VALUE => ‘closed’);
The dates printed to the console are correct but when I view the ticket
the resolved date is different than the dates printed to the console by
6 hours. This seems to me to be the off set for the time zone. What do
I need to add for Request Tracker to take the date as is?
This is why I developed the script to update the resolved date and timeworked. I have been trying to get this to work for months and I have completely missed the configuration you are talking about.
Thanks
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 . 262-783-6261 ext. 2296 bbaker@copesan.com
This is why I developed the script to update the resolved date and timeworked. I have been trying to get this to work for months and I have completely missed the configuration you are talking about.
Thanks
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 . 262-783-6261 ext. 2296 bbaker@copesan.com www.copesan.com
“Servicing North America with Local Care”
The dates printed to the console are correct but when I view the
ticket the resolved date is different than the dates printed to the
console by
6 hours. This seems to me to be the off set for the time zone. What
do I need to add for Request Tracker to take the date as is?
Maybe I state the issue wrong in the current configuration when a ticket is closed the TimeWorked and the Resolved date are not updated.
Is there a configuration I need to add to turn on this automated feature?
All other dates seem to be populating. Created, Started, Last Contact, Updated and they are showing the correct dates. But when a ticket is closed the “closed date” does not get populated nor does the timework.
Thanks
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 . 262-783-6261 ext. 2296 bbaker@copesan.com
The ticket resolved date is updated if the ticket status changes to an
inactive one.
Maybe you have configured you lifecycle wrong as “closed” isn’t one of
the status that RT ships with.
Maybe I state the issue wrong in the current configuration when a ticket is closed the TimeWorked and the Resolved date are not updated.
Is there a configuration I need to add to turn on this automated feature?
All other dates seem to be populating. Created, Started, Last Contact, Updated and they are showing the correct dates. But when a ticket is closed the “closed date” does not get populated nor does the timework.
Thanks
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 . 262-783-6261 ext. 2296 bbaker@copesan.com www.copesan.com
“Servicing North America with Local Care”
This is why I developed the script to update the resolved date and timeworked. I have been trying to get this to work for months and I have completely missed the configuration you are talking about.
Thanks
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 . 262-783-6261 ext. 2296 bbaker@copesan.com www.copesan.com “Servicing North America with Local Care”
The dates printed to the console are correct but when I view the
ticket the resolved date is different than the dates printed to the
console by
6 hours. This seems to me to be the off set for the time zone. What
do I need to add for Request Tracker to take the date as is?