<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Century Gothic";
panose-1:2 11 5 2 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.StileMessaggioDiPostaElettronica17
{mso-style-type:personal-compose;
font-family:"Century Gothic","sans-serif";
color:windowtext;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>Hi
all,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>I am
having a problem with a scrip that does not send emails as expected.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>I
have a queue with a mandatory custom field. If a user tries to create a ticket
in that queue from the RT interface without populating the cf, RT will
complain. However, if a user creates the ticket by sending an email RT will
happily create it.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>So I
created a scrip on that queue that checks if a mandatory cf is present, and if
it is - and it is not populated - it will put the ticket in status
"rejected". <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>Settings
are:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>Condition:
User Defined<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>Action:
Notify Requestors<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>Template:
Global template: Error: no mandatory CF<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>Stage:
TransactionBatch<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>Custom
Condition:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>my
$trans = $self->TransactionObj;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>return
0 unless $trans->Type eq "Create";<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>my
$ticket = $self->TicketObj;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>my
$CustomFields = $ticket->QueueObj->TicketCustomFields();<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>while
(my $CustomField = $CustomFields->Next()) {<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
my $nam = $CustomField->Name;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
my $typ = $CustomField->Type;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
my $vad = $CustomField->Pattern;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
$RT::Logger->info( "> CustomField: $nam \n" );<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
$RT::Logger->info( "> CustomField: $typ \n" );<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
$RT::Logger->info( "> CustomField: $vad \n" );<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
if ($vad = '(?#Mandatory)') {<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
my $val = $ticket->FirstCustomFieldValue($nam);<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
if ($val ne '') {<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
return 0;<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
} else {<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
$ticket->SetStatus("rejected");<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
}<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>
}<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>}<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>return
1;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>The
scrip works as expected, but it will not send the email to the requestor. In
the log I see this:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'>49587 - Scrip 28
OnCreateCheckCF (/opt/rtschedu/bin/../lib/RT/Action/SendEmail.pm:302)<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Courier New"'>[Thu Jun 11 07:53:27
2009] [info]: <rt-3.8.4-8458-1244706807-1237.3505-28-0@Bankadati S.I.> No
recipients found. Not sending.
(/opt/rtschedu/bin/../lib/RT/Interface/Email.pm:338)<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>I
can not understand why it is saying "No recipients found". Any ideas?<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>TIA<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>Bye<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'>Cris<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Century Gothic","sans-serif"'><o:p> </o:p></span></p>
</div>
</body>
</html>