<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>I ended up fixing the problem myself. The functioning scrip is below for anyone that would like to use it.</p>
<p><br>
</p>
<p>Scrip Name: <span id="ms-rterangepaste-start"></span><span>Set ticket to active upon customer reply</span><span id="ms-rterangepaste-end"></span></p>
<p></p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">Condition: On Correspond</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">Action: User Defined</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">Template: Blank</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;"><br>
</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">Custom action preparation code:<br>
</p>
<blockquote style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; margin: 0px 0px 0px 40px; border: none; padding: 0px;">
<p>return 1;<br>
</p>
</blockquote>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<br>
</div>
<span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">Custom action commit code:</span><br>
<p></p>
<p><br>
</p>
</div>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>my $Actor = $self->TransactionObj->Creator;</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>my $Owner = $self->TicketObj->Owner;</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div># Change status to "open" if status is "customer"</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>if( $Owner != $Actor ) {</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>if ($self->TicketObj->Status() eq 'customer' ) {</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>$self->TicketObj->SetStatus('open');</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>$RT::Logger->info("Customer replied to ticket awaiting reply. Status set to open.");</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>return 1;</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>}</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>return undef;</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>}</div>
<p></p>
</div>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>return undef;</div>
<p></p>
</div>
</blockquote>
<div style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div></div>
<br>
<p></p>
<p></p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">RT Information:</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;"><br>
</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;"><span style="font-size: 12pt;">RT 4.2.12</span><br>
</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">Perl v5.14.2 built for x86_64-linux-gnu-thread-multi</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">Apache 2.2.22</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">PHP 5.5.33-1~dotdeb+7.1<br>
</p>
<p style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">MySQL Ver 14.14 Distrib 5.5.49</p>
<br>
<p></p>
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><br>
</p>
<p>Zoey Schutt</p>
<p>Braincoral Technology, LLC</p>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> rt-users <rt-users-bounces@lists.bestpractical.com> on behalf of Zoey Schutt <zoey@braincoral.io><br>
<b>Sent:</b> Monday, May 16, 2016 8:36 AM<br>
<b>To:</b> rt-users@lists.bestpractical.com<br>
<b>Subject:</b> [rt-users] Problems with status changing scrip</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hello,</p>
<p><br>
</p>
<p>I am working on a scrip to auto-change the status of a ticket if it is set to "customer" status. However, I do not want the ticket to change status if the user who is replying to the ticket is the owner. I managed to get the status changing properly, but
as soon as I try to setup the condition it no longer works. Could someone look this over for me and tell me where I'm messing up?</p>
<p><br>
</p>
<p>Condition: On Correspond</p>
<p>Action: User Defined</p>
<p>Template: Blank</p>
<p><br>
</p>
<p><span>Custom action preparation code:</span><br>
</p>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px">
<p><span><span>return 1;</span><br>
</span></p>
</blockquote>
<div><br>
</div>
Custom action commit code:
<div><br>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px">
<div>
<div># Abort if actor is owner of ticket</div>
<div>return 1 unless $self->TicketObj->Owner != $actor->id;</div>
<div><br>
</div>
<div># Change status to "open" if status is "customer"</div>
<div>if ($self->TicketObj->Status() eq 'customer' ) {</div>
<div>$self->TicketObj->SetStatus('open');</div>
<div>$RT::Logger->info("Customer replied to ticket awaiting reply. Status set to open.");</div>
<div>return 1;</div>
<div>}</div>
<div>return undef;</div>
</div>
</blockquote>
<p><br>
</p>
<p>RT Information:</p>
<p><br>
</p>
<p><span style="font-size:12pt">RT 4.2.12</span><br>
</p>
<p><span>Perl <span>v5.14.2 <span>built for x86_64-linux-gnu-thread-multi</span></span></span></p>
<p><span><span><span>Apache <span>2.2.22</span></span></span></span></p>
<p><span><span><span><span><span>PHP 5.5.33-1~dotdeb+7.1</span><br>
</span></span></span></span></p>
<p>MySQL <span>Ver 14.14 Distrib 5.5.49</span></p>
<p><br>
</p>
<p>Thanks,</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><br>
</p>
<p>Zoey Schutt</p>
<p>Braincoral Technology, LLC</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>