50 lines
1.2 KiB
Plaintext
50 lines
1.2 KiB
Plaintext
# On receiving email (On correspondence):
|
|
# - Set Action Needed custom flag
|
|
|
|
# Custom condition:
|
|
|
|
return 0 unless $self->TransactionObj->Type eq "Correspond";
|
|
return 0 unless $self->TicketObj->FirstCustomFieldValue('Action Needed') ne "Yes";
|
|
|
|
#$self->TicketObj->Comment(Content => 'AUTO Scrip #29 Setting Action Needed - Condition');
|
|
|
|
|
|
|
|
#return 0 unless $self->TicketObj->Transactions->Last eq 'Email';
|
|
#return 0 unless $self->TicketObj->Transactions->Last->CreatorObj->Privileged;
|
|
|
|
1;
|
|
|
|
|
|
# Custom action preparation code:
|
|
|
|
1;
|
|
|
|
|
|
# Custom action commit code:
|
|
|
|
#Set custom flag on receiving external email
|
|
|
|
my $transaction = $self->TransactionObj;
|
|
my $creator_id = $transaction->Creator;
|
|
|
|
# Get the Ticket object
|
|
my $ticket = $self->TicketObj;
|
|
|
|
# Retrieve the most recent transaction (action)
|
|
my $last_transaction = $ticket->Transactions->Last;
|
|
|
|
# Access the description of the last transaction
|
|
my $last_transaction_description = $last_transaction->Description;
|
|
|
|
if ($last_transaction_description eq 'Outgoing email recorded by RT_System') {
|
|
# $self->TicketObj->Comment(Content => 'AUTO Scrip #29 Setting Action Needed - Commit'.$last_transaction_description);
|
|
} else {
|
|
$self->TicketObj->AddCustomFieldValue(Field => 'Action Needed', Value => 'Yes');
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
|
|