Form input interface

To all,

We want to create an interface to RT whereby users can create tickets 

by sending in a form thru E-mail. Has anyone done this and do you have
any examples and helpful suggestions? Thanks.

Kenn
LBNL

At Tuesday 4/17/2007 01:31 PM, Kenneth Crocker wrote:

To all,

    We want to create an interface to RT whereby users can 

create tickets by sending in a form thru E-mail. Has anyone done
this and do you have any examples and helpful suggestions? Thanks.

Kenn
LBNL

Kenn,

Do you mean filling out a web form that generates email to RT? If so,
we’ve used cgiemail to do that.

Also, Dirk Pape’s ExtractCustomFieldValues (see wiki, Contributions
section) works well with this approach so that custom field values
can be supplied in the form.

Steve

Hi Kenn,

I have something like this, but the form is a web form (php) and the e-mail
is sent from the web server (not the user). If this is what you’re doing,
I’ll be happy to share what I have. Letting the web form build the e-mail
makes it very easy to extract the data when it hits RT because you get to
define the data format.

At 10:31 AM 4/17/2007, Kenneth Crocker wrote:

To all,

    We want to create an interface to RT whereby users can create 

tickets by sending in a form thru E-mail. Has anyone done this and do you
have any examples and helpful suggestions? Thanks.

Kenn
LBNL

Gene LeDuc, GSEC
Security Analyst
San Diego State University

Stephen,

Actually, we were thinking along the lines of a form (filled out by the 

user/requestor) attached to an E_mail, if that’s possible. I think there
is a way to initiate a shell program when E_mail comes to a particular
address, but I’m not sure that’s the best way to do this.

Kenn
LBNL

Stephen Turner wrote:

Gene,

We don't want the user/requestor to use the web interface at all for 

creating the ticket. Thanks.

Kenn
LBNL

Gene LeDuc wrote:

Here’s the OnCreate scrip I use to create a DNS ticket from e-mail that is
lines. The first is the string that I chose to use to separate the fields
and the second line contains all the data separated by the string on the
first line. I did it this way so that I don’t have to hard-code the
separator into the scrip, it’s provided by the e-mail. I only log the last
of the CF transactions because it’s used to trigger another scrip.

Gene

Extract fields from e-mail

my $MyName = “Scrip DNS:35:Commit (New Ticket)”;
my $Transaction = $self->TransactionObj;
my $CurrentUser = $Transaction->CurrentUser;
my $Ticket = $self->TicketObj;
my $Content = $Transaction->Content;
my ($sep) = $Content =~ /(^.*$)/m;
chomp $sep;
$Content =~ s/\A$sep\n//s;
chomp $Content;

At this point, =$sep contains my separator string and $Content contains

the rest of the e-mail
#$RT::Logger->debug("$MyName: $sep: ‘$sep’");
#$RT::Logger->debug("$MyName: $Content: ‘$Content’");
my ($mName, $mIp, $mLoc, $mOs, $uName, $uPhone, $uEmail, $uDept, $uIp,
$uAgent, $uComments) = split($sep, $Content);
set_custom(‘IP’, $mIp);
set_custom(‘Location’, $mLoc);
set_custom(‘OS’, $mOs);
set_custom(‘User Name’, $uName);
set_custom(‘Phone’, $uPhone);
set_custom(‘E-Mail’, $uEmail);
set_custom(‘Dept’, $uDept);
set_custom(‘Comments’, $uComments);
set_custom(‘User IP’, $uIp);
set_custom(‘User Agent’, $uAgent);
set_custom(‘Machine Name’, $mName, 1);

Sets custom field value

set_custom($field_name, $field_value)

sub set_custom {
my ($CFName, $CFValue, $record) = @_;
#$RT::Logger->debug("$MyName: set_custom($CFName, ‘$CFValue’)");
my $cf = RT::CustomField->new($CurrentUser);
my ($id,$msg) = $cf->LoadByName(Name=>$CFName,);
if (!$id) {
$RT::Logger->debug("$MyName: Couldn’t load CF ($CFName)");
return undef;
} else {

$RT::Logger->debug("$MyName: CF($CFName) loaded, id: " . $cf->id());

}
($id, $msg) = $Ticket->AddCustomFieldValue
(Field=>$cf, Value=>$CFValue, RecordTransaction=>$record ?
$record : 0);

$RT::Logger->info("$MyName: CustomFieldValue ($CFName,$CFValue) added:

$id $msg");
}

At 11:38 AM 4/17/2007, Kenneth Crocker wrote: