<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
On Oct 26, 2016, at 2:29 PM, Alex Hall <<a href="mailto:ahall@autodist.com" class="">ahall@autodist.com</a>> wrote:<br class="">
<div>
<blockquote type="cite" class=""><br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">Hi all,<br class="">
</div>
The way our company uses RT, there's no need to distinguish between comments and replies, and users may use either one without realizing the difference. In my new email template, I want to show whichever was set. My template works fine without the two if statements
I'm trying to use, but as soon as I put them in, it fails. The odd thing is that, though the email using the template is never sent, I don't get any errors at all. When I was missing a dollar sign earlier, I got an error--an error not really related to the
dollar sign, but an error. Now, though, I get nothing whatsoever. Here's the snippet:<br class="">
<br class="">
{ if (my $transactionCorrespond = $Transaction->correspond) { $transactionCorrespond<br class="">
} elsif (my $transactionComment = $Transaction->comment) { $transactionComment }<br class="">
}<br class="">
<br class="">
</div>
I don't know what's so wrong with that bit of code, but there must be something. I don't really speak Perl, and the only page I've found thus far that enumerates the Transaction object properties isn't overly helpful, so I'm guessing at the properties I need.
Can anyone see what I've done wrong here? Thanks.<br clear="all" class="">
</div>
</div>
</blockquote>
<div><br class="">
</div>
</div>
Since $Transaction is a thing then $Transaction->correspond is empty since it's not a thing. This is why you'll get no errors.
<div class=""><br class="">
</div>
<div class="">Try this:<br class="">
<div class=""><font face="Courier New" class="">{</font></div>
<div class=""><font face="Courier New" class=""> if ($self->TransactionObj->Type eq 'Correspond') {</font></div>
<div class=""><font face="Courier New" class=""> # something</font></div>
<div class=""><font face="Courier New" class=""> } elsif ($self->TransactionObj->Type eq 'Comment') {</font></div>
<div class=""><font face="Courier New" class=""> # something else</font></div>
<div class="">
<div class=""><font face="Courier New" class=""> } else {</font></div>
<div class=""><font face="Courier New" class=""> # Not a Comment or Correspond transaction</font></div>
<div class=""><font face="Courier New" class=""> }</font></div>
<div class=""><font face="Courier New" class="">}</font><br class="">
<div class=""><br class="webkit-block-placeholder">
</div>
<div class="">Or something that actually does exactly what your pseudocode does:</div>
<div class=""><font face="Courier New" class="">{ $self->TransactionObj->Type }</font></div>
<div class=""><br class="">
</div>
<div class="">I have found these very helpful in the past:</div>
<div class=""><a href="https://rt-wiki.bestpractical.com/wiki/CustomConditionSnippets" class="">https://rt-wiki.bestpractical.com/wiki/CustomConditionSnippets</a></div>
<div class=""><br class="">
</div>
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
--<br class="">
Landon Stewart<br class="">
Lead Analyst - Abuse and Security Management<br class="">
INTERNAP ®<br class="">
📧 <a href="mailto:lstewart@internap.com" class="">lstewart@internap.com</a><br class="">
🌍 <a href="http://www.internap.com" class="">www.internap.com</a></div>
</div>
</div>
<br class="">
</div>
</div>
</div>
</body>
</html>