[rt-users] Move ticket to queue based on Requestor

Kenneth Crocker kfcrocker at lbl.gov
Wed Feb 23 13:48:06 EST 2011


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
LBNL



On Wed, Feb 23, 2011 at 10:23 AM, Gareth Tupper <gareth at phonepower.com>wrote:

> 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 at company.com,
> bob at company.com’) and then set the Department field for the ticket.
>
>
>
> Is this kind of thing even possible?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110223/e134c941/attachment.htm>


More information about the rt-users mailing list