Create Ticket on Resolve, but only if Custom Field is.... (Repost for the 15th time)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

OK, I am getting ever so closer to getting this to work.

I have two Custom Fields: Billable and Followup.

I want to create a followup ticket if Followup is Yes.
I want to create an invoice ticket if Billable is Yes/Covered/or/Gratis

Here is my Billable scrip code:

Condition User Defined
Action Create Tickets
Template Global Template Create-Invoice

return 0 unless $self->TransactionObj->Type eq “Resolved”;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Yes/i;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Covered/i;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Gratis/i;
$RT::Logger->debug(“Scrip running”);
1;

and the Billable Template:

===Create-Ticket: generate-invoice
Queue: Accounting
Requestor: {$Tickets{‘TOP’}->OwnerObj->EmailAddress() }
RefersTo: {$Tickets{‘TOP’}->Id() }
Content: Please generate an invoice for this customer.
Billable was set to:
{$Tickets}{‘TOP’}->TicketObj->FirstCustomFieldValue(‘Billable’)}

Billable hours was set to:
{$Tickets}{‘TOP’}->TicketObj->FirstCustomFieldValue(‘Billable Hours’)}
Please refer to previous ticket for more information.
ENDOFCONTENT

For Followup:

Condition User Defined
Action Create Ticket
Template Global Template Generate-Followup

===Create-Ticket: generate-followup
Queue: Customer Service
Requestor: {$Tickets{‘TOP’}->OwnerObj->EmailAddress() }
RefersTo: {$Tickets{‘TOP’}->Id() }
Content: A follow up was requested on this ticket. Please refer to
previous ticket for more information.
ENDOFCONTENT

When I resolve a ticket which has Yes in both fields, there are various
entries in the /var/log/messages, but none of them refer to scrip 22 or 23.

  • From the RT_Config.pm debug messages should go to syslog or
    /var/log/messages, but nothing is mentioned there.

I would greatly appreciate any help in finally nailing this down.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFHQ2y0b/8X6V5MpAURAlp8AKDDLcltuZDewNav8c0VBSFDRpQF3ACffE+a
iM5cJtwPm6LDU/CyvjRxi/w=
=NgU1
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

That is a good point, however the Followup condition is not executing
either!!

Roedel, Mark wrote:

It seems to me that this condition code:

return 0 unless $self->TransactionObj->Type eq “Resolved”;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Yes/i;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Covered/i;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Gratis/i;
$RT::Logger->debug(“Scrip running”);
1;

must always return zero, since at least one of your ‘unless’ conditions
won’t be met (and it’ll always return prior to your logger entry, to
boot).


Mark Roedel
Senior Programmer / Analyst
LeTourneau University

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Matt
Westfall
Sent: Tuesday, November 20, 2007 5:25 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] Create Ticket on Resolve, but only if Custom Field
is… (Repost for the 15th time)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

OK, I am getting ever so closer to getting this to work.

I have two Custom Fields: Billable and Followup.

I want to create a followup ticket if Followup is Yes.
I want to create an invoice ticket if Billable is Yes/Covered/or/Gratis

Here is my Billable scrip code:

Condition User Defined
Action Create Tickets
Template Global Template Create-Invoice

return 0 unless $self->TransactionObj->Type eq “Resolved”;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Yes/i;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Covered/i;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Gratis/i;
$RT::Logger->debug(“Scrip running”);
1;

and the Billable Template:

===Create-Ticket: generate-invoice
Queue: Accounting
Subject: Invoice: { $Tickets{‘TOP’} → Subject() }
Requestor: {$Tickets{‘TOP’}->OwnerObj->EmailAddress() }
RefersTo: {$Tickets{‘TOP’}->Id() }
Content: Please generate an invoice for this customer.
Billable was set to:
{$Tickets}{‘TOP’}->TicketObj->FirstCustomFieldValue(‘Billable’)}

Billable hours was set to:
{$Tickets}{‘TOP’}->TicketObj->FirstCustomFieldValue(‘Billable Hours’)}
Please refer to previous ticket for more information.
ENDOFCONTENT

For Followup:

Condition User Defined
Action Create Ticket
Template Global Template Generate-Followup

===Create-Ticket: generate-followup
Queue: Customer Service
Subject: Invoice: { $Tickets{‘TOP’} → Subject() }
Requestor: {$Tickets{‘TOP’}->OwnerObj->EmailAddress() }
RefersTo: {$Tickets{‘TOP’}->Id() }
Content: A follow up was requested on this ticket. Please refer to
previous ticket for more information.
ENDOFCONTENT

When I resolve a ticket which has Yes in both fields, there are various
entries in the /var/log/messages, but none of them refer to scrip 22 or
23.

  • From the RT_Config.pm debug messages should go to syslog or
    /var/log/messages, but nothing is mentioned there.

I would greatly appreciate any help in finally nailing this down.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFHRHQnb/8X6V5MpAURAjNGAJsF3cVyQMygn38+K8U1FLOArYe/UwCePW+p
jPXZvyO9Gt8svKz+c3LBfs0=
=wlFo
-----END PGP SIGNATURE-----

Hi Matt,

There’s an error here:

return 0 unless $self->TransactionObj->Type eq “Resolved”;

Use
$self->TransactionObj->Type eq “Status” &&
$self->TransactionObj->NewValue eq “resolved”

Regards,
Gene

At 03:24 PM 11/20/2007, Matt Westfall wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

OK, I am getting ever so closer to getting this to work.

I have two Custom Fields: Billable and Followup.

I want to create a followup ticket if Followup is Yes.
I want to create an invoice ticket if Billable is Yes/Covered/or/Gratis

Here is my Billable scrip code:

Condition User Defined
Action Create Tickets
Template Global Template Create-Invoice

return 0 unless $self->TransactionObj->Type eq “Resolved”;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Yes/i;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Covered/i;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Gratis/i;
$RT::Logger->debug(“Scrip running”);
1;

and the Billable Template:

===Create-Ticket: generate-invoice
Queue: Accounting
Subject: Invoice: { $Tickets{‘TOP’} → Subject() }
Requestor: {$Tickets{‘TOP’}->OwnerObj->EmailAddress() }
RefersTo: {$Tickets{‘TOP’}->Id() }
Content: Please generate an invoice for this customer.
Billable was set to:
{$Tickets}{‘TOP’}->TicketObj->FirstCustomFieldValue(‘Billable’)}

Billable hours was set to:
{$Tickets}{‘TOP’}->TicketObj->FirstCustomFieldValue(‘Billable Hours’)}
Please refer to previous ticket for more information.
ENDOFCONTENT

For Followup:

Condition User Defined
Action Create Ticket
Template Global Template Generate-Followup

===Create-Ticket: generate-followup
Queue: Customer Service
Subject: Invoice: { $Tickets{‘TOP’} → Subject() }
Requestor: {$Tickets{‘TOP’}->OwnerObj->EmailAddress() }
RefersTo: {$Tickets{‘TOP’}->Id() }
Content: A follow up was requested on this ticket. Please refer to
previous ticket for more information.
ENDOFCONTENT

When I resolve a ticket which has Yes in both fields, there are various
entries in the /var/log/messages, but none of them refer to scrip 22 or 23.

  • From the RT_Config.pm debug messages should go to syslog or
    /var/log/messages, but nothing is mentioned there.

I would greatly appreciate any help in finally nailing this down.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFHQ2y0b/8X6V5MpAURAlp8AKDDLcltuZDewNav8c0VBSFDRpQF3ACffE+a
iM5cJtwPm6LDU/CyvjRxi/w=
=NgU1
-----END PGP SIGNATURE-----


The rt-users Archives

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we’ll take
up to 20 percent off the price. This sale won’t last long, so get in touch
today.
Email us at sales@bestpractical.com or call us at +1 617 812 0745.

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Gene LeDuc, GSEC
Security Analyst
San Diego State University

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

That still doesn’t work :frowning:

Gene LeDuc wrote:

Hi Matt,

There’s an error here:

return 0 unless $self->TransactionObj->Type eq “Resolved”;

Use
$self->TransactionObj->Type eq “Status” &&
$self->TransactionObj->NewValue eq “resolved”

Regards,
Gene

At 03:24 PM 11/20/2007, Matt Westfall wrote:
OK, I am getting ever so closer to getting this to work.

I have two Custom Fields: Billable and Followup.

I want to create a followup ticket if Followup is Yes.
I want to create an invoice ticket if Billable is Yes/Covered/or/Gratis

Here is my Billable scrip code:

Condition User Defined
Action Create Tickets
Template Global Template Create-Invoice

return 0 unless $self->TransactionObj->Type eq “Resolved”;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Yes/i;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Covered/i;
return 0 unless $self->TicketObj->FirstCustomFieldValue(‘Billable’) =~
/Gratis/i;
$RT::Logger->debug(“Scrip running”);
1;

and the Billable Template:

===Create-Ticket: generate-invoice
Queue: Accounting
Subject: Invoice: { $Tickets{‘TOP’} → Subject() }
Requestor: {$Tickets{‘TOP’}->OwnerObj->EmailAddress() }
RefersTo: {$Tickets{‘TOP’}->Id() }
Content: Please generate an invoice for this customer.
Billable was set to:
{$Tickets}{‘TOP’}->TicketObj->FirstCustomFieldValue(‘Billable’)}

Billable hours was set to:
{$Tickets}{‘TOP’}->TicketObj->FirstCustomFieldValue(‘Billable Hours’)}
Please refer to previous ticket for more information.
ENDOFCONTENT

For Followup:

Condition User Defined
Action Create Ticket
Template Global Template Generate-Followup

===Create-Ticket: generate-followup
Queue: Customer Service
Subject: Invoice: { $Tickets{‘TOP’} → Subject() }
Requestor: {$Tickets{‘TOP’}->OwnerObj->EmailAddress() }
RefersTo: {$Tickets{‘TOP’}->Id() }
Content: A follow up was requested on this ticket. Please refer to
previous ticket for more information.
ENDOFCONTENT

When I resolve a ticket which has Yes in both fields, there are various
entries in the /var/log/messages, but none of them refer to scrip 22
or 23.

  • From the RT_Config.pm debug messages should go to syslog or
    /var/log/messages, but nothing is mentioned there.

I would greatly appreciate any help in finally nailing this down.

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we’ll
take
up to 20 percent off the price. This sale won’t last long, so get in
touch today.
Email us at sales@bestpractical.com or call us at +1 617 812 0745.

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFHSukqb/8X6V5MpAURAujMAKDcyBVfftRVoPyCemLvuat04UQ7UACcDF+t
amFBvex8GCcftuaueRfUcJU=
=wVAv
-----END PGP SIGNATURE-----