[rt-users] Create Ticket on Resolve, but only if Custom Field is....

Matt Westfall mwestfall at factory7.com
Mon Nov 19 09:52:04 EST 2007


-----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)

iD8DBQFHQaMUb/8X6V5MpAURAk4MAJwMzmE4sFsvITDHVEwCu1exIckLGgCgmpmR
34F3OA7N1oRPZcHmYs3pXWw=
=sFpJ
-----END PGP SIGNATURE-----

This email was Anti Virus checked by Astaro Security Gateway. http://www.astaro.com


Ninjas Win!!




More information about the rt-users mailing list