Samir,

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:

#----------------------------------------------------------------------------
# Custom action preparation code:
#----------------------------------------------------------------------------
#
# set new values for Due Date from CF Need-by-Date
#

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $cf_date = $ticket->FirstCustomFieldValue('Need-By Date');

# split up the date parts into a temporary array

my @parts = split(/[\/-]/, $cf_date);

# put date parts back together

my $new_date = sprintf("%d-%d-%d", $parts[2], $parts[0], $parts[1]);

# format new date based on RT

my $duedate = RT::Date->new($RT::SystemUser);
$duedate->Set(Format=>'unknown', Value=>$new_date);

#
# set new ticket owner id value
#
#    42 - Chuck
#   148 - UK
#  5125 - Aurora
#  9324 - Steve
# 73886 - Ron
#

my %orgs = qw(
          Budget-Direct   148
          Budget-Indirect 148
          Controller-AP   5125
          Controller-AR   73886
          Controller-GA   148
          Controller-PR   42
          Facilities      42
          Field OPS       42
          OCFO-Other      42
          Procurement     9324
          Property        9324
          SPO             73886
          Travel          5125
          Other           42
         );

my $cf = new RT::CustomField($RT::SystemUser);
$cf->LoadByName(Queue => $ticket->QueueObj->id,Name => "CFO-Org");
return 0 unless $cf->id;
my $cfvalue = $ticket->FirstCustomFieldValue('CFO-Org'); my $ownerid = $orgs{$cfvalue};

# set Ticket Due date & Owner ID

$ticket->SetDue($duedate->ISO);
$ticket->SetOwner($ownerid);

return 1;
#----------------------------------------------------------------------------
# Custom action cleanup code:
#----------------------------------------------------------------------------

return 1;

Obviously, you would not need the "due Date" code. Perhaps you can modify this to serve your needs.

Kenn
LBNL

On 12/17/2009 11:49 PM, samir marhoum wrote:
Can any one help please ?

2009/12/16 samir marhoum <samir.marh...@gmail.com <mailto:samir.marh...@gmail.com>>

    Hi,
I need to send email notification based on a custum field value,
    ie if a CF value is X send email to j...@mail.com
    <mailto:j...@mail.com> if it's Y send to pe...@company.org
    <mailto:pe...@company.org>
Can you please help me on this ? Best Regards.


------------------------------------------------------------------------

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to