<div dir="ltr"><div>Thanks Ken,</div>
<div> </div>
<div>What I want is to put the condition in the template: here is my scrip:</div>
<div> </div>
<div>Condition: On ticket creation</div>
<div> </div>
<div>Action: Notify Requestor</div>
<div> </div>
<div>Template : in the template I want to add a variable Cc based on a custom field value:</div>
<div> </div>
<div>Cc: {'based on custom field value'}</div>
<div> </div>
<div>But I don't know the code to use for templates (which is a bit different from the one used for conditions and actions)<br></div>
<div>Here is an example of someting similar that works for me, but I can't figure out how to do it wi CFs:</div>
<div> </div>
<div>- Based on the ticket priority, a text is added to the template : (ex: Critique if priority = 20)</div>
<div> </div>
<div>------------------------------------</div>
<div>Priority: {$crit = 'Informatif' if $Ticket->Priority == '99'}{$crit = 'critique' if $Ticket->Priority == '20'}{$crit = 'Majeur' if $Ticket->Priority == '40'}{$crit = 'Mineur' if $Ticket->Priority == '60'}{$crit = 'Oteo' if $Ticket->Priority == '80'}<br>
-------------------------------------<br></div>
<div class="gmail_quote">2009/12/18 Ken Crocker <span dir="ltr"><<a href="mailto:kfcrocker@lbl.gov">kfcrocker@lbl.gov</a>></span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div text="#000000" bgcolor="#ffffff">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
<div>
<div></div>
<div class="h5"><br><br>On 12/17/2009 11:49 PM, samir marhoum wrote: </div></div>
<blockquote type="cite">
<div>
<div></div>
<div class="h5">
<div dir="ltr">Can any one help please ?<br><br>
<div class="gmail_quote">2009/12/16 samir marhoum <span dir="ltr"><<a href="mailto:samir.marhoum@gmail.com" target="_blank">samir.marhoum@gmail.com</a>></span><br>
<blockquote style="BORDER-LEFT: rgb(204,204,204) 1px solid; 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 href="mailto:john@mail.com" target="_blank">john@mail.com</a> if it's Y send to <a 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></div></div><pre><hr size="4" width="90%">
_______________________________________________
<a href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users" target="_blank">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a>
Community help: <a href="http://wiki.bestpractical.com/" target="_blank">http://wiki.bestpractical.com</a>
Commercial support: <a href="mailto:sales@bestpractical.com" target="_blank">sales@bestpractical.com</a>
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at <a href="http://rtbook.bestpractical.com/" target="_blank">http://rtbook.bestpractical.com</a></pre></blockquote></div></blockquote></div><br></div>