At Thursday 2/15/2007 01:42 PM, Kenneth Crocker wrote:
To all,


        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:

#----------------------------------------------------------------------------
# Custom condition: none
#----------------------------------------------------------------------------
# Custom action preparation code:

my $trans;
my $msgattr;
my $cf_obj;
my $cf_name;
my $cf_value;

# set description

$cf_obj = RT::CustomField->new($RT::SystemUser);
$cf_name = "Description";
$cf_value = $self->TicketObj->Subject();
$RT::Logger->debug( $self . " cf_value = ". $cf_value . "\n" );
$cf_obj->LoadByName( Name => $cf_name );
$RT::Logger->debug( "Loaded \$cf_obj->Name = ". $cf_obj->Name() ."\n" );
$cf_obj->AddValueForObject( Object=>$self->TicketObj, Content=>$cf_value, );

# determine source of transaction

$trans = $self->TransactionObj;
return 0 unless $trans->Type eq "Create";
$msgattr = $trans->Message->First;
return 0 unless $msgattr;
return 1 if $msgattr->GetHeader('Received');
return 0;


        It isn't working for me. Can anyone find the problem in my code? Thanks.


Kenn,

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?

Steve
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to