<html>
<body>
<font size=3>At Thursday 2/15/2007 01:42 PM, Kenneth Crocker wrote:<br>
<blockquote type=cite class=cite cite="">To all,<br><br>
<br>
<x-tab>        </x-tab>I am
trying to determine if a ticket is being created via E_mail and if so
move the subject to a custom field named "Description". I tried
to use this code as follows:<br><br>
#----------------------------------------------------------------------------<br>
# Custom condition: none<br>
#----------------------------------------------------------------------------<br>
# Custom action preparation code:<br><br>
my $trans;<br>
my $msgattr;<br>
my $cf_obj;<br>
my $cf_name;<br>
my $cf_value;<br><br>
# set description<br><br>
$cf_obj = RT::CustomField->new($RT::SystemUser);<br>
$cf_name = "Description";<br>
$cf_value = $self->TicketObj->Subject();<br>
$RT::Logger->debug( $self . " cf_value = ". $cf_value .
"\n" );<br>
$cf_obj->LoadByName( Name => $cf_name );<br>
$RT::Logger->debug( "Loaded \$cf_obj->Name = ".
$cf_obj->Name() ."\n" );<br>
$cf_obj->AddValueForObject( Object=>$self->TicketObj,
Content=>$cf_value, );<br><br>
# determine source of transaction<br><br>
$trans = $self->TransactionObj;<br>
return 0 unless $trans->Type eq "Create";<br>
$msgattr = $trans->Message->First;<br>
return 0 unless $msgattr;<br>
return 1 if $msgattr->GetHeader('Received');<br>
return 0;<br><br>
<br>
<x-tab>        </x-tab>It isn't
working for me. Can anyone find the problem in my code? Thanks.<br>
</blockquote><br><br>
Kenn,<br><br>
The code looks correct. In what way is it not working? Do you see
anything in the RT log? Have you tried putting logging statements in the
code to see how far it's getting? Did you remember to set the condition
to 'User Defined' in the scrip definition?<br><br>
Steve</font></body>
</html>