[rt-users] Source of new ticket: Web or email?

Kenneth Crocker KFCrocker at lbl.gov
Thu Feb 15 13:42:09 EST 2007


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
LBNL

Marouane HIMDI wrote:
> Have a look at RT WIKI
> http://wiki.bestpractical.com/index.cgi?OnCreateFromEmail
> 
> Best regards
> 
> Marouane HIMDI
> 
> Joe Casadonte a écrit :
>> Is there any way, specifically in a scrip, to determine if the ticket 
>> just created was done via the Web UI or via an email?  I would like to 
>> disable auto-replies for web transactions where the requestor is also 
>> the principal (they get instant feedback; they don't need or want the 
>> additional email).
>>
>> Thanks!
>>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> 
> 
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy 
> a copy at http://rtbook.bestpractical.com
> 



More information about the rt-users mailing list