Need help referencing custom fields in CreateTicket template

I have a Create Ticket scrip that works until I try to reference a custom
field. The template looks like this:

===Create-Ticket: hardware
Queue: Hardware

The Custom Field “Product” exists and is applied to queue that the scrip is
running in. I have set the ‘see’, ‘modify’ and ‘admin’ rights for everyone.

The worst part is that this was working fine yesterday and today it is
failing. I have tried many options to set this value that I have found on
this mailing list and I still can’t get it to work.

My RT version is 3.4.4
My server is running Ubuntu 6.10
The syslog error is:
Aug 23 13:08:29 support-server RT: Exiting subroutine via next at
/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm line 980.
(/usr/share/request-tracker3.4/lib/RT.pm:287)

Any suggestions would be greatly appreciated.
View this message in context: http://www.nabble.com/Need-help-referencing-custom-fields-in-CreateTicket-template-tf4320089.html#a12302188

Hi David,

Try turning your logging level up to Debug (in RT_SiteConfig.pm) and then
see what turns up in rt.log. Remember to restart your web server so the
change takes effect.

Regards,
Gene

At 03:09 PM 8/23/2007, davidturnau wrote:

I have a Create Ticket scrip that works until I try to reference a custom
field. The template looks like this:

===Create-Ticket: hardware
Queue: Hardware
Subject: {$Ticket->FirstCustomFieldValue(‘Product’);}

The Custom Field “Product” exists and is applied to queue that the scrip is
running in. I have set the ‘see’, ‘modify’ and ‘admin’ rights for everyone.

The worst part is that this was working fine yesterday and today it is
failing. I have tried many options to set this value that I have found on
this mailing list and I still can’t get it to work.

My RT version is 3.4.4
My server is running Ubuntu 6.10
The syslog error is:
Aug 23 13:08:29 support-server RT: Exiting subroutine via next at
/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm line 980.
(/usr/share/request-tracker3.4/lib/RT.pm:287)

Any suggestions would be greatly appreciated.

View this message in context:
http://www.nabble.com/Need-help-referencing-custom-fields-in-CreateTicket-template-tf4320089.html#a12302188
Sent from the Request Tracker - User mailing list archive at Nabble.com.


The rt-users Archives

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

David,

We are also on 3.4.4 and we have several scrips that use custom fields. 

are you sure it is still enabled sinceothers can mess with it the way
your privileges are set? Has someone modified it? What is the code?

Kenn
LBNL

davidturnau wrote:

Thanks Gene. I had some problems figuring out my permissions on rt.log
which is why I didn’t set that at first and include the info. I’ve got that
straight now. The results of the log are below but I think the pertinent
line is:

template line 2.

I don’t understand why that value is “undefined”. The custom field is named
“Product” (capitalized and spelled correctly).

-dt

[Thu Aug 23 23:00:18 2007] [debug]: About to think about scrips for
transaction #44161
(/usr/share/request-tracker3.4/lib/RT/Transaction_Overlay.pm:156)
[Thu Aug 23 23:00:18 2007] [debug]: About to prepare scrips for transaction
#44161 (/usr/share/request-tracker3.4/lib/RT/Transaction_Overlay.pm:160)
[Thu Aug 23 23:00:18 2007] [debug]: Found 7 scrips
(/usr/share/request-tracker3.4/lib/RT/Scrips_Overlay.pm:356)
[Thu Aug 23 23:00:18 2007] [debug]: Line: ===
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:774)
[Thu Aug 23 23:00:18 2007] [debug]: Line: ===Create-Ticket: hardware
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:777)
[Thu Aug 23 23:00:18 2007] [debug]: **** Create ticket: create-hardware
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:791)
[Thu Aug 23 23:00:18 2007] [debug]: Line: Queue: Hardware
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:777)
[Thu Aug 23 23:00:18 2007] [debug]: Line: Subject:
{$Ticket->FirstCustomFieldValue(‘Product’);},
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:777)
[Thu Aug 23 23:00:18 2007] [debug]: About to commit scrips for transaction
#44161 (/usr/share/request-tracker3.4/lib/RT/Transaction_Overlay.pm:169)
[Thu Aug 23 23:00:18 2007] [debug]: In CreateByTemplate
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:561)
[Thu Aug 23 23:00:18 2007] [debug]: Workflow: processing create-hardware of
RT::Ticket=HASH(0xd4e7fc4)
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:576)
[Thu Aug 23 23:00:18 2007] [debug]: Workflow: evaluating
Queue: Hardware
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:955)
[Thu Aug 23 23:00:18 2007] [debug]: Workflow: yielding
Queue: Hardware
template line 2.

Stack:
[template:2]
[/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:969]
[/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:582]
[/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:522]
[/usr/share/request-tracker3.4/lib/RT/ScripAction_Overlay.pm:241]
[/usr/share/request-tracker3.4/lib/RT/Scrip_Overlay.pm:507]
[/usr/share/request-tracker3.4/lib/RT/Scrips_Overlay.pm:192]
[/usr/share/request-tracker3.4/lib/RT/Transaction_Overlay.pm:170]
[/usr/share/request-tracker3.4/lib/RT/Record.pm:1431]
[/usr/share/request-tracker3.4/lib/RT/Record.pm:1661]
[/usr/share/request-tracker3.4/lib/RT/Record.pm:1565]
[/usr/share/request-tracker3.4/lib/RT/Interface/Web.pm:1239]
[/usr/share/request-tracker3.4/html/Ticket/Modify.html:71]
[/usr/share/request-tracker3.4/html/autohandler:215]
,
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:971)
[Thu Aug 23 23:00:18 2007] [error]: Ticket creation failed: Can’t call
method “FirstCustomFieldValue” on an undefined value at template line 2.

Stack:
[template:2]
[/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:969]
[/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:582]
[/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:522]
[/usr/share/request-tracker3.4/lib/RT/ScripAction_Overlay.pm:241]
[/usr/share/request-tracker3.4/lib/RT/Scrip_Overlay.pm:507]
[/usr/share/request-tracker3.4/lib/RT/Scrips_Overlay.pm:192]
[/usr/share/request-tracker3.4/lib/RT/Transaction_Overlay.pm:170]
[/usr/share/request-tracker3.4/lib/RT/Record.pm:1431]
[/usr/share/request-tracker3.4/lib/RT/Record.pm:1661]
[/usr/share/request-tracker3.4/lib/RT/Record.pm:1565]
[/usr/share/request-tracker3.4/lib/RT/Interface/Web.pm:1239]
[/usr/share/request-tracker3.4/html/Ticket/Modify.html:71]
[/usr/share/request-tracker3.4/html/autohandler:215]
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:974)
[Thu Aug 23 23:00:18 2007] [warning]: Exiting subroutine via next at
/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm line 980.
(/usr/share/request-tracker3.4/lib/RT.pm:287)

Gene LeDuc wrote:

Hi David,

Try turning your logging level up to Debug (in RT_SiteConfig.pm) and then
see what turns up in rt.log. Remember to restart your web server so the
change takes effect.

Regards,
Gene

At 03:09 PM 8/23/2007, davidturnau wrote:

I have a Create Ticket scrip that works until I try to reference a custom
field. The template looks like this:

===Create-Ticket: hardware
Queue: Hardware
Subject: {$Ticket->FirstCustomFieldValue(‘Product’);}

The Custom Field “Product” exists and is applied to queue that the scrip
is
running in. I have set the ‘see’, ‘modify’ and ‘admin’ rights for
everyone.

The worst part is that this was working fine yesterday and today it is
failing. I have tried many options to set this value that I have found on
this mailing list and I still can’t get it to work.

My RT version is 3.4.4
My server is running Ubuntu 6.10
The syslog error is:
Aug 23 13:08:29 support-server RT: Exiting subroutine via next at
/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm line 980.
(/usr/share/request-tracker3.4/lib/RT.pm:287)

Any suggestions would be greatly appreciated.

View this message in context:
http://www.nabble.com/Need-help-referencing-custom-fields-in-CreateTicket-template-tf4320089.html#a12302188
Sent from the Request Tracker - User mailing list archive at Nabble.com.


The rt-users Archives

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


The rt-users Archives

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

View this message in context: http://www.nabble.com/Need-help-referencing-custom-fields-in-CreateTicket-template-tf4320089.html#a12303794

Update:
This is no longer a custom fields issue. Everything works fine with text but
I can’t call perl in the template at all (it seems)

I have changed the subject line to:Subject: {$Ticket->id}
and
Subject: {$Ticket->id()}

and got the following error in rt.log each time:

Subject: Can’t call method “id” on an undefined value at template line 2.

-dt

davidturnau wrote:

I have a Create Ticket scrip that works until I try to reference a custom
field. The template looks like this:

===Create-Ticket: hardware
Queue: Hardware
Subject: {$Ticket->FirstCustomFieldValue(‘Product’);}

The Custom Field “Product” exists and is applied to queue that the scrip
is running in. I have set the ‘see’, ‘modify’ and ‘admin’ rights for
everyone.

The worst part is that this was working fine yesterday and today it is
failing. I have tried many options to set this value that I have found on
this mailing list and I still can’t get it to work.

My RT version is 3.4.4
My server is running Ubuntu 6.10
The syslog error is:
Aug 23 13:08:29 support-server RT: Exiting subroutine via next at
/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm line 980.
(/usr/share/request-tracker3.4/lib/RT.pm:287)

Any suggestions would be greatly appreciated.

View this message in context: http://www.nabble.com/Need-help-referencing-custom-fields-in-CreateTicket-template-tf4320089.html#a12303840

Hi David,

I’ve never used a template to create a ticket so I might be off base
here. Does $Ticket exist within a Create Ticket template? It seems tome
that it might not until after the ticket has been created. If it doesn’t
exist yet, that would explain the undefined value ($Ticket). Just a thought.

Gene

At 04:20 PM 8/23/2007, davidturnau wrote:

Update:
This is no longer a custom fields issue. Everything works fine with text but
I can’t call perl in the template at all (it seems)

I have changed the subject line to:
Subject: {$Ticket->id}
and
Subject: {$Ticket->id()}

and got the following error in rt.log each time:

Subject: Can’t call method “id” on an undefined value at template line 2.

-dt

davidturnau wrote:

I have a Create Ticket scrip that works until I try to reference a custom
field. The template looks like this:

===Create-Ticket: hardware
Queue: Hardware
Subject: {$Ticket->FirstCustomFieldValue(‘Product’);}

The Custom Field “Product” exists and is applied to queue that the scrip
is running in. I have set the ‘see’, ‘modify’ and ‘admin’ rights for
everyone.

The worst part is that this was working fine yesterday and today it is
failing. I have tried many options to set this value that I have found on
this mailing list and I still can’t get it to work.

My RT version is 3.4.4
My server is running Ubuntu 6.10
The syslog error is:
Aug 23 13:08:29 support-server RT: Exiting subroutine via next at
/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm line 980.
(/usr/share/request-tracker3.4/lib/RT.pm:287)

Any suggestions would be greatly appreciated.


View this message in context:
http://www.nabble.com/Need-help-referencing-custom-fields-in-CreateTicket-template-tf4320089.html#a12303840
Sent from the Request Tracker - User mailing list archive at Nabble.com.


The rt-users Archives

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

You might be on to something. I have a scrip that creates a ticket in my
Hardware queue when a certain field is updated. I want to pull data from the
original ticket (ticket id, custom field value) and populate the template
that is used to create the new ticket. Is my syntax wrong? Is my template
trying to pull the data from fields in a ticket that doesn’t exist yet
instead of the original ticket? If so, how do I reference the original
ticket in the perl tag?

I’ve also used “TOP” in my syntax without any luck. I’ve seen some
references to it in the forums but I don’t really understand what it does or
how to use it.

I’ve used it with the following syntax:

but I just end up with the same error in rt.log

Gene LeDuc wrote:

Hi David,

I’ve never used a template to create a ticket so I might be off base
here. Does $Ticket exist within a Create Ticket template? It seems tome
that it might not until after the ticket has been created. If it doesn’t
exist yet, that would explain the undefined value ($Ticket). Just a
thought.

Gene

At 04:20 PM 8/23/2007, davidturnau wrote:

Update:
This is no longer a custom fields issue. Everything works fine with text
but
I can’t call perl in the template at all (it seems)

I have changed the subject line to:
Subject: {$Ticket->id}
and
Subject: {$Ticket->id()}

and got the following error in rt.log each time:

Subject: Can’t call method “id” on an undefined value at template line 2.

-dt

davidturnau wrote:

I have a Create Ticket scrip that works until I try to reference a
custom
field. The template looks like this:

===Create-Ticket: hardware
Queue: Hardware
Subject: {$Ticket->FirstCustomFieldValue(‘Product’);}

The Custom Field “Product” exists and is applied to queue that the
scrip
is running in. I have set the ‘see’, ‘modify’ and ‘admin’ rights for
everyone.

The worst part is that this was working fine yesterday and today it is
failing. I have tried many options to set this value that I have found
on
this mailing list and I still can’t get it to work.

My RT version is 3.4.4
My server is running Ubuntu 6.10
The syslog error is:
Aug 23 13:08:29 support-server RT: Exiting subroutine via next at
/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm line 980.
(/usr/share/request-tracker3.4/lib/RT.pm:287)

Any suggestions would be greatly appreciated.


View this message in context:
http://www.nabble.com/Need-help-referencing-custom-fields-in-CreateTicket-template-tf4320089.html#a12303840
Sent from the Request Tracker - User mailing list archive at Nabble.com.


The rt-users Archives

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


The rt-users Archives

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

View this message in context: http://www.nabble.com/Need-help-referencing-perl-in-CreateTicket-template-tf4320089.html#a12304265