Create Ticket but only if Custom Field is

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

I’m having the hardest time figuring out how to create a ticket based on
the status of a Custom Field.

I have two Custom Fields

1: Billable
It’s a select one field with values of:
Yes
No
Covered
Gratis

2: Followup
It’s a select one field with values of:
Yes
No

I have the two corresponding scrips written:

1: Invoice

Condition: User Defined
Action: Create Tickets
Template: Generate-Invoice

Custom Condition:
return 0 unless $trans->Type eq “Resolve”;

return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Yes/i);
return 1;
return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Gratis/i);
return 1;

return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Covered/i);
return 1;

2:

Condition: User Defined:
Action: Create Tickets:
Template: generate-followup

Custom Condition:

return 0 unless $trans->Type eq “Resolve”;

return undef unless ($self->TicketObj->FirstCustomFieldValue(‘Followup’)
=~ /Yes/i);
return 1;

I have two corresponding templates created:

1:
===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

2:
===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

I then created a test ticket with Billable set to Yes and Followup to
Yes, and neither ticket spawned!!!

Help please!!!

Thanks in advance,
Matt Westfall
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFHKQ1+b/8X6V5MpAURAi1NAKDRvuX8M0kaKOaOyDizS8eQOCgzuwCgkTK+
vBVDrWY9oeqcF5gDg5113AE=
=YQKv
-----END PGP SIGNATURE-----

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

I’m having the hardest time figuring out how to create a ticket based on
the status of a Custom Field.

I have two Custom Fields

1: Billable
It’s a select one field with values of:
Yes
No
Covered
Gratis

2: Followup
It’s a select one field with values of:
Yes
No

I have the two corresponding scrips written:

1: Invoice

Condition: User Defined
Action: Create Tickets
Template: Generate-Invoice

Custom Condition:
return 0 unless $trans->Type eq “Resolve”;

return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Yes/i);
return 1;
return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Gratis/i);
return 1;

return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Covered/i);
return 1;

2:

Condition: User Defined:
Action: Create Tickets:
Template: generate-followup

Custom Condition:

return 0 unless $trans->Type eq “Resolve”;

return undef unless ($self->TicketObj->FirstCustomFieldValue(‘Followup’)
=~ /Yes/i);
return 1;

I have two corresponding templates created:

1:
===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

2:
===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

I then created a test ticket with Billable set to Yes and Followup to
Yes, and neither ticket spawned!!!

Help please!!!

Thanks in advance,
Matt Westfall
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFHKxjhb/8X6V5MpAURAozCAJ4rNUBDQ9/w4LcHmrpxMk6aWVZUjwCeM7Xb
3W3tz2lW/N7k2YMq8QUBaCg=
=FtON
-----END PGP SIGNATURE-----

I’m having the hardest time figuring out how to create a ticket based on
the status of a Custom Field.

Matt,

Try looking at this wiki page:

http://wiki.bestpractical.com/view/OnCustomFieldValueChange

At the bottom you’ll find the solution that worked best for me when I need to trigger a scrip on a particular value of a custom field. Good luck.

-Tim

Tim Wilson, Director of Technology
Buffalo-Hanover-Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us

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

I’m having the hardest time figuring out how to create a ticket based on
the status of a Custom Field.

I have two Custom Fields

1: Billable
It’s a select one field with values of:
Yes
No
Covered
Gratis

2: Followup
It’s a select one field with values of:
Yes
No

I have the two corresponding scrips written:

1: Invoice

Condition: User Defined
Action: Create Tickets
Template: Generate-Invoice

Custom Condition:
return 0 unless $trans->Type eq “Resolve”;

return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Yes/i);
return 1;
return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Gratis/i);
return 1;

return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Covered/i);
return 1;

Why do you have so many “return 1” statements?

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

Because I’m not entirely sure what I should have written!!!

But the follow up code, which only has 1, doesn’t work either :frowning:

Todd Chapman wrote:

I’m having the hardest time figuring out how to create a ticket based on
the status of a Custom Field.

I have two Custom Fields

1: Billable
It’s a select one field with values of:
Yes
No
Covered
Gratis

2: Followup
It’s a select one field with values of:
Yes
No

I have the two corresponding scrips written:

1: Invoice

Condition: User Defined
Action: Create Tickets
Template: Generate-Invoice

Custom Condition:
return 0 unless $trans->Type eq “Resolve”;

return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Yes/i);
return 1;
return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Gratis/i);
return 1;

return undef unless
($self->TicketObj->FirstCustomFieldValue(‘Name_of_your_Custom_Field’) =~
/Covered/i);
return 1;

Why do you have so many “return 1” statements?

2:

Condition: User Defined:
Action: Create Tickets:
Template: generate-followup

Custom Condition:

return 0 unless $trans->Type eq “Resolve”;

return undef unless ($self->TicketObj->FirstCustomFieldValue(‘Followup’)
=~ /Yes/i);
return 1;

I have two corresponding templates created:

1:
===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

2:
===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

I then created a test ticket with Billable set to Yes and Followup to
Yes, and neither ticket spawned!!!

Help please!!!

Thanks in advance,
Matt Westfall
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

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

iD8DBQFHLIrGb/8X6V5MpAURAny8AJ9Qda8ZjcVVcjUC5LEntb6jKx9WogCgzBvT
Yut0u7xtMUuC2TPKNqeEx7k=
=1jEs
-----END PGP SIGNATURE-----

Send what you have now and I’ll help you get it right.