[rt-users] How to modify ticket content from an OnCreate Scrip?
Konstantin Khomoutov
flatworm at users.sourceforge.net
Tue Aug 24 14:50:50 EDT 2010
In our setup, we need to record IP address/host name of the computer
from which a user submitted his/her request using Web UI.
Our idea is to create an OnCreate Scrip which would read the REMOTE_ADDR
environment variable, resolve the IP address from it, construct some
descriptive string (like "The request was from $ip [$hostname]") and
append it to the ticket in some way.
The REMOTE_ADDR environment variable is perfectly accessible from
OnCreate Scrips in our setup (Apache with mod_perl), but I have
troubles updating the ticket's content: I would love to somehow modify
the request text, but see no apparent way to do this. I managed to
create a "correspond" transaction for this ticket, but this has one
significant downside: it makes RT send another mail to queue watchers
which results in issuing two e-mails for admins per each request, and I
would love to have RT generate just one notify e-mail with updated
ticket text.
Is there a way to implement such direct updating of the request text
for RT 3.8.8?
The Scrip we're currently using (which uses Correspond) is below:
if (defined $ENV{REMOTE_ADDR}) {
use Socket;
my $raddr = $ENV{REMOTE_ADDR};
my $ip = inet_aton($raddr);
my $rhost = gethostbyaddr($ip, AF_INET);
my $info = "Request was from $raddr [$rhost]";
my ($tid, $msg, $obj) = $self->TicketObj->Correspond(
( Content => $info ));
if ($tid != 0) {
$RT::Logger->info($info);
} else {
$RT::Logger->error("Failed recording client's computer name: $msg");
}
} else {
$RT::Logger->info("REMOTE_ADDR is not defined");
}
return 1;
More information about the rt-users
mailing list