[rt-users] Accessing custom fields from templates
Graeme Pyle
graeme at raspberry.co.za
Mon Nov 3 12:07:55 EST 2003
I eventually figured this out. To set custom field "n" from custom field
"m", include the line
CustomField-n: {$Tickets{'TOP'}->CustomFieldValues(m)->Next()->Content}
Note that custom fields are not referenced according to their absolute
positions in the queue (i.e. the first custom field in queue A does not
necessarily have id 1). Rather, id's are allocated sequentially across
all queues.
To find the id of a custom field, go to the edit page for that field in
the configuration and read it from the URL:
www.example.com/Admin/Queues/CustomField.html?Queue=3&CustomField=2
(id is 2 in this example)
Note that there is a problem with the code for setting the custom field.
See below
Cheers,
Graeme
--snip-snip--
Hi folks,
I found that RT 3.0.6 was unable to set custom fields from templates
because the regular expression used to match the key in the template
included a dash '-', which is automatically removed when the template is
parsed.
For example, you include "CustomField-3: hoohaa" in your template, but
RT strips the key to "customfield3" and not "customfield-3".
So, line 457 in "lib/RT/Action/CreateTickets.pm"
$key =~ /^customfield-(\d+)$/ or next;
should read
$key =~ /^customfield(\d+)$/ or next;
instead (dash removed).
Cheers,
Graeme
--snip-snip--
Graeme Pyle wrote:
> Hi folks,
>
> I'm trying to auto-create a ticket in another queue on creation of a
> ticket in a given queue. This works fine, but I'm not sure how to copy
> the value of one of the custom fields across to the new ticket.
>
> It seems you can access the subject line as below:
>
> --snip-snip--
> Subject: Credit Approval for {$Tickets{'TOP'}->Subject}
> --snip-snip--
>
> and also set the custom field:
>
> --snip-snip--
> CustomField-1: $1000
> --snip-snip--
>
> but I can't get at the value of the custom field in the originating
> ticket. I thought perhaps "$Tickets{'TOP'}->CustomField-<id#>" would
> work, but it doesn't.
>
> Has anyone done this before? I'm assuming it must be possible.
>
> Thanks,
>
> Graeme
>
>
> _______________________________________________
> rt-users mailing list
> rt-users at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-users
>
> Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm
>
>
More information about the rt-users
mailing list