Gareth,
Sure, we have something like that. See below:
Custom Condition:
condition set on email transaction to create
my $trans = $self->TransactionObj;
my $msgattr = $trans->Message->First;
return 0 unless $trans->Type eq “Create”;
return 0 unless $msgattr;
return 1 if $msgattr->GetHeader(‘Received’);
return 0;
Custom Prep Action:
Set up initial values
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $actor = $trans->CreatorObj;
my $name = $actor->Name;
set Custom FIeld value based on Senders’ Name
my %values = qw(
BobSmith Sales
ASmith Dev
JJones whatever3
);
my $CFvalue = $values{$name};
exit if name not found
return 0 unless $CFvalue;
set the CF “Department”
my $cf_obj = RT::CustomField->new($RT::SystemUser);
my $cf_name = “Department”;
$cf_obj->LoadByName(Name=>$cf_name);
$RT::Logger->debug(“Loaded$cf_obj->Name = “. $cf_obj->Name() .”\n”);
$ticket->AddCustomFieldValue(Field=>$cf_obj, Value=>$CFvalue,
RecordTransaction=>0);
return 1;
Custom Cleanup Action:
return 1;
Something like that should do it.
Kenn
LBNLOn Wed, Feb 23, 2011 at 10:23 AM, Gareth Tupper gareth@phonepower.comwrote:
Hallo
I’m getting lost in a sea of perl…
I have a Custom Field for tickets, called Department. This contains Sales,
Dev, etc.
I’m trying to set up a scrip that will look at the requestor’s email
address for an incoming ticket (is email address in: ‘alice@company.com,
bob@company.com’) and then set the Department field for the ticket.
Is this kind of thing even possible?