Stephen,
Thanks for looking at this. Originally, the following code put the
subject info into CF "Description" and it worked:
#
#----------------------------------------------------------------------------
# Custom condition: none
#----------------------------------------------------------------------------
# Custom action preparation code:
my $cf_obj;
my $cf_name;
my $cf_value;
$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, );
return 1;
However, I modified it (see earlier code) to do this only if it was an
E_mail ticket. I have the condition set to "OnCreate" and the action as
"User Defined" and the code in the custom action preparation area. Upon
execution, the ticket is created via E_mail but the description is
blank, whereas before it was the same as the subject. I have not
accessed the logs (another department and they are busy) so I'll try
that next, maybe I'll get a clue there. Thanks again.
Kenn
LBNL
Stephen Turner wrote:
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