[rt-devel] Modifying Custom Fields in a Custom Scrip

James Goss jgoss1074 at yahoo.com
Tue May 20 13:42:40 EDT 2003


Hi all,

I'm attempting to implement a custom scrip (via the web interface) to
automatically modify a custom field when a new ticket is created.  If
the requestor of the ticket matches a string (e.g., from user
someuser at somewhere.com) then set the 'Severity' Custom Field value to be
'Critical'.  However, I'm not doing it correctly and am not sure why...
My current code results in the error "Custom field Severity not found"
being logged.

I am by no means a skilled or experienced perl coder, so please forgive
any horrible errors or poor methods...  Any assistance is appreciated...

my $email;
my @emails;
my $result = 0;
my $resultmessage;

@emails = $self->TicketObj->Requestors->MemberEmailAddresses();

open LOG, ">>/opt/rt3/mylog";
print LOG @emails, "\n";

foreach $email (@emails) {
  print LOG $email, ":  ";

  if ($email =~ /.*someuser.*/i) {
    ($result, $resultmessage) =
$self->TicketObj->AddCustomFieldValue(Field => 'Severity', Value =>
'Critical');

    print LOG $resultmessage, "\n";
  } else {
    print LOG "none\n";
  }
}

close LOG;

return ($result);

Thanks,

Jim




More information about the Rt-devel mailing list