[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rt-users
Subject:    Re: [rt-users] Move ticket to queue based on Requestor
From:       Kenneth Crocker <kfcrocker () lbl ! gov>
Date:       2011-02-23 18:48:06
Message-ID: AANLkTi=OOH4jLwQ4OqpQcZA8XYgQk4N+NweYBFZhwp2G () mail ! gmail ! com
[Download RAW message or body]

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@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@company.com,
> bob@company.com’) and then set the Department field for the ticket.
>
>
>
> Is this kind of thing even possible?
>

[Attachment #3 (text/html)]

Gareth,<br><br>Sure, we have something like that. See below:<br><br>Custom \
Condition:<br># condition set on email transaction to create<br><br>my $trans = \
$self-&gt;TransactionObj;<br>my $msgattr = $trans-&gt;Message-&gt;First;<br> \
<br>return 0 unless $trans-&gt;Type eq &quot;Create&quot;;<br>return 0 unless \
$msgattr;<br>return 1 if $msgattr-&gt;GetHeader(&#39;Received&#39;);<br>return \
0;<br><br><br>Custom Prep Action:<br># Set up initial values<br> <br>my $trans = \
$self-&gt;TransactionObj;<br>my $ticket = $self-&gt;TicketObj;<br>my $actor = \
$trans-&gt;CreatorObj;<br>my $name = $actor-&gt;Name; <br><br>#<br># set Custom FIeld \
value based on Senders&#39; Name<br>#<br> <br>my %values = qw(<br>             \
BobSmith     Sales<br>             ASmith        Dev<br>             JJones         \
whatever3<br>               );<br><br>my $CFvalue = $values{$name};<br><br># exit if \
name not found<br> <br>return 0 unless $CFvalue;<br><br># set the CF \
&quot;Department&quot;<br><br>my $cf_obj = \
RT::CustomField-&gt;new($RT::SystemUser);<br>my $cf_name = \
&quot;Department&quot;;<br>$cf_obj-&gt;LoadByName(Name=&gt;$cf_name);<br> \
$RT::Logger-&gt;debug(&quot;Loaded\$cf_obj-&gt;Name = &quot;. $cf_obj-&gt;Name() \
.&quot;\n&quot;);<br>$ticket-&gt;AddCustomFieldValue(Field=&gt;$cf_obj, \
Value=&gt;$CFvalue, RecordTransaction=&gt;0);<br><br>return 1;<br><br> Custom Cleanup \
Action:<br><br>return 1;<br><br><br>Something like that should do \
it.<br><br>Kenn<br>LBNL<br><br><br><br><div class="gmail_quote">On Wed, Feb 23, 2011 \
at 10:23 AM, Gareth Tupper <span dir="ltr">&lt;<a \
href="mailto:gareth@phonepower.com">gareth@phonepower.com</a>&gt;</span> wrote:<br> \
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px \
solid rgb(204, 204, 204); padding-left: 1ex;"><div link="blue" vlink="purple" \
lang="EN-US"><div><p class="MsoNormal">Hallo</p><p class="MsoNormal">  </p><p \
class="MsoNormal">I’m getting lost in a sea of perl..</p><p class="MsoNormal"> </p><p \
class="MsoNormal">I have a Custom Field for tickets, called Department.  This \
contains Sales, Dev, etc.</p><p class="MsoNormal">  </p><p class="MsoNormal">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: ‘<a href="mailto:alice@company.com" \
target="_blank">alice@company.com</a>, <a href="mailto:bob@company.com" \
target="_blank">bob@company.com</a>’) and then set the Department field for the \
ticket.</p> <p class="MsoNormal"> </p><p class="MsoNormal">Is this kind of thing even \
possible?</p></div></div></blockquote></div><br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic