Open Tickets Action sets tickets to Open regardless of status

Hi,

We have recently added some new ticket statuses in using Lifecycles. Since then every time a ticket receives a reply it will change the ticket status to ‘open’ even if its in an ‘active’ status. We have the default Scrip enabled to Open tickets on correspond but we only want this to reopen resolved tickets on correspond. Is there a way to restrict this scrip to only reopen resolved tickets?

Any advice on this would be much appreciated.

Regards,
Mike

What you could do is disable the existing scrip that opens these tickets and then create a new scrip that still uses the ‘open inactive tickets’ action but write a custom condition to check if status is resolved and the transaction type is a correspond.

Thank you, I created the custom condition as suggested and this seems to work correctly. The condition I used below seems to work.

my $TransactionObj = $self->TransactionObj;
my $ticket = $self->TicketObj;

return 1 if $ticket->Status eq ‘resolved’ && $TransactionObj->Type eq ‘Correspond’;

return 0;

I’ve a related issue to this and I’ve tried to experiment with the above code-sample. In our case we only want Correspondance to switch to Open if an outside-actor is corresponding. I’ve a hard time figuring out how to identify this code-wise though, i.e. if Owner/AdminCC corresponds it shouldn’t switch to Open, otherwise it should.

Try adding the line below into your code. This should only return true if the message is from an external source.

$self->TransactionObj->IsInbound

Hi, thanks! This only took me halfway though as IsInbound only returns true for the requestor but for induviduals that’s CC that may respond to the ticket doesn’t trigger the ticket to open which is a neededd function.

You can use the ticket object to check if the creator of the transaction is an owner or adminCc if they are not then run the script.

https://docs.bestpractical.com/rt/4.4.4/RT/Ticket.html#IsOwner
https://docs.bestpractical.com/rt/4.4.4/RT/Ticket.html#IsAdminCc-PRINCIPAL_ID

retun 0 if $self->TicketObj->IsAdminCc($self->TransactionObj->CreatorObj->Id);
retun 0 if $self->TicketObj->IsOwner($self->TransactionObj->CreatorObj);

return 1;

I didn’t test this code but it should be very close.

Thanks for the feedback @craig , however this was soley for CC.

I solved it by doing as follows:

return 0 unless $self->TransactionObj->Type eq "Correspond";

my $User = RT::User->new($RT::SystemUser);
$User->LoadOrCreateByEmail($self->TransactionObj->CreatorObj->EmailAddress);

return 1 if $self->TicketObj->IsWatcher(Type => 'Cc', PrincipalId => $User->PrincipalId);
return 1 if $self->TransactionObj->IsInbound;

return 0;

Any feedback on above is appreciated!