Hi,
When my helpdesk agents reply to a Resolved ticket the ticket changes
status back to Open. This is done by a scrip called “On Correspond Open
Ticket with Template Blank”.
I want to modify the behaviour of the scrip so that it only sets the
status to Open when the incoming email is not from my helpdesk agents.
Has anyone done something similar ?
Is there a sample custom scrip that I can use to start the development
from ?
Kind regards
Andre Sachs
Andre Sachs
Developer
Clue Technologies
asachs@clue.co.za
Mobile: +27-83-277-5677
Office: +27-21-434-8034
Fax: +27-21-434-4572
1 Like
Hello, poster from 18 years ago and any future readers.
I came across this post because I wanted to do the same thing, and I’ve been spending some time reading Action code recently and I think I understand how to implement this behavior.
Create a new script, and use the On Correspond condition.
Set your action as UserDefined, and use the following for the Prepare and Commit blocks:
Custom action preparation code:
my $ticket = $self->TicketObj;
return 0 if $ticket->LifecycleObj->IsActive( $ticket->Status );
return 0 unless $self->TransactionObj->IsInbound;
my $next = $ticket->FirstActiveStatus;
return 0 unless defined $next;
$self->{'set_status_to'} = $next;
return 1;
Custom action commit code:
return 1 unless my $new_status = $self->{'set_status_to'};
my ($val, $msg) = $self->TicketObj->SetStatus( $new_status );
unless ( $val ) {
$RT::Logger->error( "Couldn't auto-open-inactive ticket: ". $msg );
return 0;
}
return 1;
IsInbound
does the heavy lifting here; it is true when the initiator of the transaction is one of the ticket requestors.
Most of this code is borrowed from lib/RT/Action/AutoOpen.pm
and lib/RT/Action/AutoOpenInactive.pm
, neither of which do what you’re looking for on their own.
If you don’t want your action to apply to tickets with an initial
status, make sure you change the first guard to:
return 0 unless $ticket->LifecycleObj->IsInactive( $ticket->Status );
This ensures that the action will only apply to inactive
tickets.