<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 18 August 2013 22:05, Dave Fitches <span dir="ltr"><<a href="mailto:david.fitches@unimelb.edu.au" target="_blank">david.fitches@unimelb.edu.au</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div lang="EN-AU" link="blue" vlink="purple">
<div>
<p class="">My template goes something like this:<br></p><p class=""><u></u></p>
<p class=""><u></u> <u></u></p>
<p class="" style="text-indent:36pt"># Set the jobs Due Date from E-mail Body<u></u><u></u></p>
<p class="" style="text-indent:36pt">|Body|(?<=Open Date: ).*|my $due_date = $value; $due_date->Set(Format => "ISO", Value => $value); $self->TicketObj->SetDue( $due_date->ISO );|q|<u></u><u></u></p>
<p class=""><u></u> <u></u></p>
<p class="">This does NOT work for me… <span style="font-family:Wingdings">
L</span> <u></u><u></u></p>
<p class="">Instead I get: “ [Mon Aug 19 04:47:17 2013] [error]: Can't call method "Set" on an undefined value at (eval 1293) line 1. “ in my logs…</p></div></div></blockquote><div><br></div><div style>$due_date needs to be an RT::Date object in order to use set or ISO. Is it? </div>
<div style><br></div><div style>ie:</div><div style>$due_date = new RT::Date( $self->CurrentUser );</div><div style><span style="text-indent:48px">$due_date->Set(Format => "ISO", Value => $value);</span><br>
</div><div style><span style="text-indent:48px">$self->TicketObj->SetDue( $due_date->ISO );</span><span style="text-indent:48px"><br></span></div><div style><span style="text-indent:48px"><br></span></div><div style>
<span style="text-indent:48px">Since your dates are not in ISO format I'd probably recommend using Format => 'unknown' to set the RT::Date figure it out. It takes a few extra cycles but provides flexibility when needed.</span></div>
<div style><span style="text-indent:48px"><br></span></div><div style><span style="text-indent:48px">I use this:</span></div><div style><span style="text-indent:48px">my $Due = new RT::Date( $self->CurrentUser );</span></div>
<div style><span style="text-indent:48px">$Due->Set( Format => 'unknown', Value => 'now + 24 hours');</span></div><div style><span style="text-indent:48px">$ticket->SetDue($Due->ISO);</span></div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-AU" link="blue" vlink="purple">
<p class="">
<u></u><u></u></p>
<p class="">Problem #2: Writing a comment to the transaction history<u></u><u></u></p>
<p class="">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u><u></u></p>
<p class="">While it shows up in my main HISTORY display, my DISPLAY history is masked to only show comments and correspondence, so I’d like a single comment line there to make seeing whats happened easier…<u></u><u></u></p>
<p class=""> CUSTOM ACTION CLEANUP CODE:<br></p><p class=""><u></u></p>
<p class=""> $self->TicketObj->Comment(Content =>"Notification sent to original requestor that their order has been processed."<u></u><u></u></p>
<p class="" style="margin-left:72pt;text-indent:36pt">);<u></u><u></u></p>
<p class="">I suspect the issue is in the cleanup code…. But it LOOKS correct! (to me – but I’m a n00b apparently!)<br></p></div></blockquote><div style>If I'm understanding you correctly and if memory serves me I *think* you can just add RecordTransaction => 1 to the end of this and it'll do what you want. I know this works for AddCustomFieldValue() but I'm not 100% sure if it works for Comment(). Worth a try though.</div>
<div style><br></div><div style>$self->TicketObj->Comment(Content =>"Notification sent to original requestor that their order has been processed.", RecordTransaction => 1);<br clear="all"><div><br></div>
-- <br><div>Landon Stewart <LandonStewart@Gmail.com><br></div>
<br><div><span style="font-family:arial;font-size:small"><br></span></div><div><span style="font-family:arial;font-size:small"><br></span></div></div>
</div></div></div>