Ticket autoclose Scrip not working :(

I want RT to automatically close tickets containing “FCR” in the subject
I wrote the following according to the documentation , but it’s not working

Custom condition :
my $subject = $self->TicketObj->Subject;
return 0 unless $subject =~ m/FCR #/;
return 1;

Custom action preparation code:

RT->Logger->error(“Preparing custom scrip 49 Custom action”);
RT->Logger->error($self->TicketObj->Status);
$self->TicketObj->SetStatus( “resolved” );
1;

Can you please tell me why it always keep them open?
Thanks.

Do you get anything appear in the logs? Is the action in the scrip set to “User Defined”?

Yes of course i did.
See attached;

Workflow description:
all emails come to a general queue then emails are routed to their queues.
Might it be the Condition which is wrong?

I think you need to input “return 1;” in the “action preparation code” to make the “action commit code” run.

Also, probably not related, you mentioned “FCR in the subject”, but your regex is searching for “FCR #”

I’ll try that. thanks / as for the FCR in my subject , yes the hash is the part of the pattern

Your Custom Condition isn’t being actioned based upon the screenshot provided as you have the Condition set to On Queue Change.

This needs to be set to User Defined, and in additon to your existing Custom condition code, you need to manually detect the Queue Change prior to executing your custom condition code (if you only want this to action on a Queue Change).

As sunnavy stated, you also need “return 1;” in the “action preparation code”.

This is quite often question. Maybe developers should add some javascript with red error message next to the code fields stating there is no “User defined” condition or action chosen :slight_smile:

1 Like