Using SQL Statements in Approval Templates

Hi everyone,
I’m running RT 3.4.0 on debian linux 3.4 with perl 5.8.4, mysql 4.1.9, mod_perl 1 with apache 1.3 and i’m trying to find a way of retrieving a requestors name from the RT database. pls, is it possible to use sql statements in templates and if it is, can anyone be kind enough to help me with the code snippet. thanks in anticipation of your help. The template i’m given is shown below but the code isn’t working.

===Create-Ticket: Need Approval
{
my $RequestorEmail = $Ticket->RequestorAddresses;
SELECT DISTINCT
Users.Name AS rName FROM USERS
WHERE
Users.EmailAddress=$RequestorEmail;
my $RequestorName =$record->rName
}
Depended-On-By: {$Tickets{‘TOP’}->Id}
Type: approval
Queue: Approvals
Owner: {$RequestorName}
Status: Open
Content-Type: text/html
Content: Your approval is requested for the ticket
{$Tickets{“TOP”}->Id}: {$Tickets{“TOP”}->Subject}.




Please visit {$RT::WebURL}Approvals/Display.html?id={$Ticket->id+1}
to approve or reject this ticket, or {$RT::WebURL}Approvals/ to
batch-process all your pending approvals.








{$Transaction->Content()}

ENDOFCONTENT

part of the error code i got is given below:

ENDOFCONTENT
(/opt/rt3/lib/RT/Action/CreateTickets.pm:952)
[Thu Mar 3 22:07:56 2005] [debug]: Workflow: yielding
Can’t modify concatenation (.) or string in scalar assignment at template line 6, at EOF

Depended-On-By: 259
Type: approval
Queue: Approvals
Owner:
Status: Open
Content-Type: text/html
Content: Your approval is requested for the ticket
259: test.




Please visit http://rt2.ipnxtelecoms.com:80/Approvals/Display.html?id=251
to approve or reject this ticket, or http://rt2.ipnxtelecoms.com:80/Approvals/ to
batch-process all your pending approvals.








This transaction appears to have no content

ENDOFCONTENT
(/opt/rt3/lib/RT/Action/CreateTickets.pm:968)
[Thu Mar 3 22:07:56 2005] [error]: Ticket creation failed: Can’t modify concatenation (.) or string in scalar assignment at template line 6, at EOF
(/opt/rt3/lib/RT/Action/CreateTickets.pm:971)
[Thu Mar 3 22:07:56 2005] [warning]: Exiting subroutine via next at /opt/rt3/lib/RT/Action/CreateTickets.pm line 977.
(/opt/rt3/lib/RT.pm:277)
[Thu Mar 3 22:19:54 2005] [info]: Successful login for root from 10.50.1.107 (/opt/rt3/share/html/autohandler:197)

Send instant messages to your online friends http://uk.messenger.yahoo.com