Take time as Starts Date value


#1

I would like to update Starts date when user takes a ticket but only for the first time. During ticket creation Starts date and Created date is the same, so it is one of my condition. I don’t know how to control sql fields from Ticket table (there are starts and created date which are visible in ticket properties).
Conditions:
my $tck = $Tickets;
my $txn = $self->TransactionObj;
return 0 unless $txn->Type eq “Set”;
return 0 unless $txn->Field eq “Owner”;
return 0 unless $txn->OldValue == $RT::Nobody->id;
return 0 unless $txn->NewValue == $txn->Creator;
return 0 unless $tck->Created ne $tck->Starts;
return 1;
Commit code:
$self->TicketObj->AddCustomFieldValue(
Field => ‘Reakcja’,
Value => $self->TransactionObj->Created
);
$Tickets->Starts => $Tickets->Created;
return 1;

EDIT:
I did some modification and my condition works good now, but I still have a problem with action code which should modify Ticket’s starts date.

$self->TicketObj->SetStarts (
Format => ‘ISO’,
Value => ‘20180101 11:11:11’
);
Scrip runs properly, but history of ticket shows below lines. If this is a problem with Value format or I simply can’t modify Starts date and it will be overwritten permanently by created date (created date for this ticket is 29/01/2018 08:09:00).

Mon Jan 29 12:48:29 2018 The RT System itself - Starts changed from Mon Jan 29 08:09:00 2018 to Not set
Mon Jan 29 12:48:29 2018 The RT System itself - Starts changed from Not set to Mon Jan 29 08:09:00 2018


#2

Hello again,
My scrip works fine and right now when first RT operator will take a ticket starts date will be overwritten by current datetime.

Right now I would like to create a saved search will show me tickets for which difference between starts date and created date is e.g. greater than 1 hour. I’m trying to add custom search result column but it doesn’t work in my RTIR. According to documentation I added my Column_Map to
/opt/rt4/local/plugins/RT-IR/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
and created file
/opt/rt4/local/plugins/RT-IR/html/RTIR/Search/Elements/BuildFormatString/Default
but with no effects.
Which log should I check or what else should I change to see my custom results column in Build Search section?