CF values based on incoming To: address (question)

Created this scrip according to the wiki,

$self->TicketObj->Transactions->First->Attachments->First->GetHeader
(“To”);

my $cf_value = “”;
$cf_value = “DBA” if ($to =~ /^dba-request@rt.bizsys.com/i);
$cf_value = “SAP” if ($to =~ /^sap-request@rt.bizsys.com/i);
$cf_value = “IR (Phoenix)” if ($to =~ /^ir-request@rt.bizsys.com/i);
$cf_value = “Sys Admin” if ($to =~ /^sa-request@rt.bizsys.com/i);
$cf_value = “No Value” if ($to =~ /^rt@rt.bizsys.com/i);

my $CF_Obj = RT::CustomField->new($RT::SystemUser);
my $cf_name = “Requestor-Org”;

$RT::Logger->debug( $self . " cf_value = ". $cf_value . “\n” );

$CF_Obj->LoadByName( Name => $cf_name, Queue => ‘0’,);
$RT::Logger->debug( “Loaded $CF_Obj->Name = “. $CF_Obj->Name
() .”\n” );
$CF_Obj->AddValueForObject( Object => $self->TicketObj,
Content => $cf_value, );
return 1;

created a scrip with the above, but getting this in the logs

[Mon Feb 6 17:34:34 2006] [debug]: RT::Action::UserDefined=HASH
(0xb562968) cf_value = Sys Admin
((eval 411):13)
[Mon Feb 6 17:34:34 2006] [debug]: Loaded $CF_Obj->Name =
((eval 411):16)

Chaim Rieger

chaim.rieger@gmail.com