Trouble with scrip to set status based on email subject

Trying to set up this Scrip to set Resolved status based on email subject.
It is auto-closing all tickets.
Any ideas? I have to be missing something basic. I already tested the
regex match separately. I also thought I had the logic reversed but tested
it both ways (!~ and =~).

TIA,
Dave

Description: Auto Close Google Checkout emails
Condition: On Create
Action: User Defined
Template: Global Template: Blank
Stage: TransactionCreate

Custom condition:
my $match = “Order [0-9][0-9]+ has been cancelled by Google”;
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject =~ /$match/i ) {
return 1;
}
else {
return 0;
}

Custom action preparation code:

return 1;

Custom action cleanup code:

$self->TicketObj->SetStatus( “resolved” );
return 1;

Forgot to mention - running 4.0.2.

-DaveOn Tue, Aug 30, 2011 at 10:53 AM, Dave Pascoe davekm3t@gmail.com wrote:

Trying to set up this Scrip to set Resolved status based on email subject.
It is auto-closing all tickets.
Any ideas? I have to be missing something basic. I already tested the
regex match separately. I also thought I had the logic reversed but tested
it both ways (!~ and =~).

TIA,
Dave

Description: Auto Close Google Checkout emails
Condition: On Create
Action: User Defined
Template: Global Template: Blank
Stage: TransactionCreate

Custom condition:
my $match = “Order [0-9][0-9]+ has been cancelled by Google”;
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject =~ /$match/i ) {
return 1;
}
else {
return 0;
}

Custom action preparation code:

return 1;

Custom action cleanup code:

$self->TicketObj->SetStatus( “resolved” );
return 1;

Shouldn’t that be TransactionBatch and not TransactionCreate?

Cheers,
KenOn Tue, Aug 30, 2011 at 11:17:54AM -0400, Dave Pascoe wrote:

Forgot to mention - running 4.0.2.

-Dave

On Tue, Aug 30, 2011 at 10:53 AM, Dave Pascoe davekm3t@gmail.com wrote:

Trying to set up this Scrip to set Resolved status based on email subject.
It is auto-closing all tickets.
Any ideas? I have to be missing something basic. I already tested the
regex match separately. I also thought I had the logic reversed but tested
it both ways (!~ and =~).

TIA,
Dave

Description: Auto Close Google Checkout emails
Condition: On Create
Action: User Defined
Template: Global Template: Blank
Stage: TransactionCreate

Custom condition:
my $match = “Order [0-9][0-9]+ has been cancelled by Google”;
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject =~ /$match/i ) {
return 1;
}
else {
return 0;
}

Custom action preparation code:

return 1;

Custom action cleanup code:

$self->TicketObj->SetStatus( “resolved” );
return 1;


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA ? September 26 & 27, 2011
  • San Francisco, CA, USA ? October 18 & 19, 2011
  • Washington DC, USA ? October 31 & November 1, 2011
  • Melbourne VIC, Australia ? November 28 & 29, 2011
  • Barcelona, Spain ? November 28 & 29, 2011

I tried TransactionBatch, same result.On Tue, Aug 30, 2011 at 11:26 AM, ktm@rice.edu ktm@rice.edu wrote:

Shouldn’t that be TransactionBatch and not TransactionCreate?

Cheers,
Ken

On Tue, Aug 30, 2011 at 11:17:54AM -0400, Dave Pascoe wrote:

Forgot to mention - running 4.0.2.

-Dave

On Tue, Aug 30, 2011 at 10:53 AM, Dave Pascoe davekm3t@gmail.com wrote:

Trying to set up this Scrip to set Resolved status based on email
subject.
It is auto-closing all tickets.
Any ideas? I have to be missing something basic. I already tested the
regex match separately. I also thought I had the logic reversed but
tested
it both ways (!~ and =~).

TIA,
Dave

Description: Auto Close Google Checkout emails
Condition: On Create
Action: User Defined
Template: Global Template: Blank
Stage: TransactionCreate

Custom condition:
my $match = “Order [0-9][0-9]+ has been cancelled by Google”;
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject =~ /$match/i ) {
return 1;
}
else {
return 0;
}

Custom action preparation code:

return 1;

Custom action cleanup code:

$self->TicketObj->SetStatus( “resolved” );
return 1;


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA ? September 26 & 27, 2011
  • San Francisco, CA, USA ? October 18 & 19, 2011
  • Washington DC, USA ? October 31 & November 1, 2011
  • Melbourne VIC, Australia ? November 28 & 29, 2011
  • Barcelona, Spain ? November 28 & 29, 2011

Dave,

Your scrip is telling RT on Create (> > > Condition: On Create) => resolve the ticket.
You can either change your condition to User defined and add a bit of logic to your Custom condition: to identify ticket creation. Or keep your condition to On Create and move your:
my $match = “Order [0-9][0-9]+ has been cancelled by Google”;
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject =~ /$match/i ) {
return 1;
}
else {
return 0;
}

To the custom action prepare code.

Hope that helps ;
Roy

Visit our website today www.daisygroupplc.com

Registered Office: Daisy House, Lindred Road Business Park, Nelson, Lancashire BB9 5SR
Company Registration Number: 4145329 | VAT Number: 722471355
Daisy Communications Limited is a company registered in England and Wales.
DISCLAIMER

This email (including any attachments) is strictly confidential and may also be legally privileged. If the recipient has received this email in error please notify the sender and do not read, print, re-transmit, store or act in reliance on the email or its attachments and immediately delete this email and its attachments from the recipient’s system. Daisy Communications Limited cannot accept liability for any breaches of confidence arising through use of email. Employees of Daisy Communications Limited are expressly required not to make any defamatory statements and not to infringe or authorise any infringement of copyright or any other legal right by email communications. Any such communication is contrary to the company’s policy and outside the scope of the employment of the individual concerned. Daisy Communications Limited will not accept any liability in respect of such a communication, and the employee responsible will be personally liable for any damages or other liability arising.

If you are the intended recipient of this email please ensure that neither the email nor any attachments are copied to third parties outside your organisation or saved without the written permission of the sender. In the event of any unauthorised copying or forwarding, the recipient will be required to indemnify Daisy Communications Limited against any claim for loss or damage caused by any viruses or otherwise.

WARNING: Computer viruses can be transmitted by email. The recipient should check this email and any attachments for the presence of viruses. Daisy Communications Limited accepts no liability for any damage caused by any virus transmitted by this email or any attachments.
NOTICE TO CUSTOMERS
If you have ordered a telephone number from Daisy Communications Limited (non-geographic or new line installation) please do NOT arrange for any form of advertising until the number is live and tested.-----Original Message-----

From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-
bounces@lists.bestpractical.com] On Behalf Of ktm@rice.edu
Sent: 30 August 2011 16:27
To: Dave Pascoe
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Trouble with scrip to set status based on email
subject

Shouldn’t that be TransactionBatch and not TransactionCreate?

Cheers,
Ken

On Tue, Aug 30, 2011 at 11:17:54AM -0400, Dave Pascoe wrote:

Forgot to mention - running 4.0.2.

-Dave

On Tue, Aug 30, 2011 at 10:53 AM, Dave Pascoe davekm3t@gmail.com wrote:

Trying to set up this Scrip to set Resolved status based on email
subject.
It is auto-closing all tickets.
Any ideas? I have to be missing something basic. I already tested
the
regex match separately. I also thought I had the logic reversed but
tested
it both ways (!~ and =~).

TIA,
Dave

Description: Auto Close Google Checkout emails
Condition: On Create
Action: User Defined
Template: Global Template: Blank
Stage: TransactionCreate

Custom condition:
my $match = “Order [0-9][0-9]+ has been cancelled by Google”;
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject =~ /$match/i ) {
return 1;
}
else {
return 0;
}

Custom action preparation code:

return 1;

Custom action cleanup code:

$self->TicketObj->SetStatus( “resolved” );
return 1;


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA ? September 26 & 27, 2011
  • San Francisco, CA, USA ? October 18 & 19, 2011
  • Washington DC, USA ? October 31 & November 1, 2011
  • Melbourne VIC, Australia ? November 28 & 29, 2011
  • Barcelona, Spain ? November 28 & 29, 2011

RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA September 26 & 27, 2011
  • San Francisco, CA, USA October 18 & 19, 2011
  • Washington DC, USA October 31 & November 1, 2011
  • Melbourne VIC, Australia November 28 & 29, 2011
  • Barcelona, Spain November 28 & 29, 2011

Thanks for the tips…my initial mistake was selecting OnCreate rather than
Custom Defined for the condition. Whoops.

Thanks, all.

Dave