<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Samir,<br>
<br>
I do something similar to that. Based on the value of a (ticket) Custom
Field, I assign a ticket owner. This is the code I use:<br>
<br>
#----------------------------------------------------------------------------<br>
# Custom action preparation code:<br>
#----------------------------------------------------------------------------<br>
#<br>
# set new values for Due Date from CF Need-by-Date<br>
#<br>
<br>
my $trans = $self->TransactionObj;<br>
my $ticket = $self->TicketObj;<br>
my $cf_date = $ticket->FirstCustomFieldValue('Need-By Date');<br>
<br>
# split up the date parts into a temporary array<br>
<br>
my @parts = split(/[\/-]/, $cf_date);<br>
<br>
# put date parts back together<br>
<br>
my $new_date = sprintf("%d-%d-%d", $parts[2], $parts[0], $parts[1]);<br>
<br>
# format new date based on RT<br>
<br>
my $duedate = RT::Date->new($RT::SystemUser);<br>
$duedate->Set(Format=>'unknown', Value=>$new_date);<br>
<br>
#<br>
# set new ticket owner id value<br>
#<br>
# 42 - Chuck<br>
# 148 - UK<br>
# 5125 - Aurora <br>
# 9324 - Steve<br>
# 73886 - Ron <br>
#<br>
<br>
my %orgs = qw(<br>
Budget-Direct 148<br>
Budget-Indirect 148<br>
Controller-AP 5125<br>
Controller-AR 73886<br>
Controller-GA 148<br>
Controller-PR 42<br>
Facilities 42<br>
Field OPS 42<br>
OCFO-Other 42<br>
Procurement 9324<br>
Property 9324<br>
SPO 73886<br>
Travel 5125<br>
Other 42<br>
);<br>
<br>
my $cf = new RT::CustomField($RT::SystemUser);<br>
$cf->LoadByName(Queue => $ticket->QueueObj->id,Name =>
"CFO-Org");<br>
return 0 unless $cf->id;<br>
my $cfvalue = $ticket->FirstCustomFieldValue('CFO-Org'); <br>
my $ownerid = $orgs{$cfvalue};<br>
<br>
# set Ticket Due date & Owner ID<br>
<br>
$ticket->SetDue($duedate->ISO);<br>
$ticket->SetOwner($ownerid);<br>
<br>
return 1;<br>
#----------------------------------------------------------------------------<br>
# Custom action cleanup code: <br>
#----------------------------------------------------------------------------<br>
<br>
return 1;<br>
<br>
Obviously, you would not need the "due Date" code. Perhaps you can
modify this to serve your needs.<br>
<br>
Kenn<br>
LBNL<br>
<br>
On 12/17/2009 11:49 PM, samir marhoum wrote:
<blockquote
cite="mid:378a2ec80912172349y691caa15h92b53cefbc461494@mail.gmail.com"
type="cite">
<div dir="ltr">Can any one help please ?<br>
<br>
<div class="gmail_quote">2009/12/16 samir marhoum <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:samir.marhoum@gmail.com">samir.marhoum@gmail.com</a>></span><br>
<blockquote
style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"
class="gmail_quote">
<div dir="ltr">
<div>Hi,</div>
<div> </div>
<div>I need to send email notification based on a custum field
value, ie if a CF value is X send email to <a moz-do-not-send="true"
href="mailto:john@mail.com" target="_blank">john@mail.com</a> if it's
Y send to <a moz-do-not-send="true" href="mailto:peter@company.org"
target="_blank">peter@company.org</a></div>
<div> </div>
<div>Can you please help me on this ?</div>
<div> </div>
<div>Best Regards.</div>
</div>
</blockquote>
</div>
<br>
</div>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
<a class="moz-txt-link-freetext" href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a>
Community help: <a class="moz-txt-link-freetext" href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</a>
Commercial support: <a class="moz-txt-link-abbreviated" href="mailto:sales@bestpractical.com">sales@bestpractical.com</a>
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at <a class="moz-txt-link-freetext" href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</a></pre>
</blockquote>
</body>
</html>