<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 26 September 2013 10:45, Bryon Baker <span dir="ltr"><<a href="mailto:bbaker@copesan.com" target="_blank">bbaker@copesan.com</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">

Ok tried something on my own I copied "SetPriority.pm" module to ChangeQueue.pm and change code to<br>
<br>
When I try and execute this with rt-crontool I get<br>
<br>
[Thu Sep 26 17:39:21 2013] [critical]: Failed to load module RT::Action::ChangeQueue. () at /usr/bin/rt-crontool line 305. (/usr/lib/perl5/vendor_perl/5.16.2/RT.pm:400)<br>
Failed to load module RT::Action::ChangeQueue. () at /usr/bin/rt-crontool line 305.<br>
<br>
I have compared the permissions on both file and everything looks the same.<br>
<br>package RT::Action::ChangeQueue;<br>
use base 'RT::Action';<br>
<br>
use strict;<br>
use warnings;<br>
<br>
#Do what we need to do and send it out.<br>
<br>
#What does this type of Action does<br>
<br>
sub Describe  {<br>
  my $self = shift;<br>
  return (ref $self . " will set a ticket's priority to the argument provided.");<br></blockquote><div><br></div><div style>That looks weird…  ref $self?  That'd probably return "HASH will set ticket's…" or something.  I'd nuke it entirely anyway since you don't need this sub.</div>

<div style> </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">
sub Prepare  {<br>
    # nothing to prepare<br>
    return 1;<br>
}<br></blockquote><div><br></div><div style>Nuke this since you don't need it.</div><div style> </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">

sub Commit {<br>
    my $self = shift;<br>
    my $currentqueue = $<b>ticket</b>->Queue;<br></blockquote><div><br></div><div style>You haven't dereferenced $self->TicketObj into $ticket yet above.</div><div style> </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">

##  Did this to validate what is happening before I do it.<br>
    print "Current Queue $currentqueue, New Queue <b>$self->Argument</b>\n";<br>
#    $self->TicketObj->SetQueue($self->Argument);<br>
<br>
}<br></blockquote><div><br></div><div style>This print line would be interpreted as:</div><div style>print "Current Queue ".$currentqueue.", New Queue ".$self."->Argument\n";  </div><div style>

<br></div><div style>Probably not what you want…  </div><div style><br></div><div style><b><u>By the way there might already be an action called SetQueue.pm in your lib/RT/Actions/ directory.</u></b><br></div><div style>
<br>
</div><div style>If you want to keep working on your module though - try this.  This ChangeQueue.pm should be located in /opt/rt4/lib/RT/Action/ or equivalent.  I've removed SetQueue() like you did so it won't actually modify the ticket.</div>

<div style><div><br></div><div><font face="courier new, monospace">package RT::Action::ChangeQueue;<br>use base 'RT::Action';<br><br>use strict;<br>use warnings;<br><br>sub Commit {<br>    my $self = shift;</font></div>

<div><font face="courier new, monospace">    my $ticket = $self->TicketObj;<br>    my $cq = $ticket->Queue;</font></div><div style><font face="courier new, monospace">    my $nq = $self->Argument;</font></div><div>

<font face="courier new, monospace"><br>    print "Current Queue $cq, New Queue $nq\n";</font></div><div style><font face="courier new, monospace">    # or</font></div><div><font face="courier new, monospace">    print "Current Queue ".$self->TicketObj->Queue.", New Queue ".$self->Argument."\n";</font></div>

<div><font face="courier new, monospace">    # or</font></div><div><font face="courier new, monospace">    </font><span style="font-family:'courier new',monospace">print "Current Queue ".$ticket->Queue.", New Queue ".$self->Argument."\n";</span></div>

<div><span style="font-family:'courier new',monospace">}</span><br></div><div><font face="courier new, monospace"><br>RT::Base->_ImportOverlays();<br><br>1;</font><br><div class="gmail_extra"><br></div><div class="gmail_extra" style>

Give this line a new Queue ID# and a ticket # and watch the magic:</div><div class="gmail_extra">/opt/rt4/bin/rt-crontool --search RT::Search::FromSQL --action RT::Action::ChangeQueue --action-arg "<qid>" --transaction first --verbose --search-arg 'id = <ticketid>'<br>

</div></div></div></div><div><br></div><div><br></div>-- <br><div dir="ltr"><div><span style="font-family:arial;font-size:small">Landon Stewart :: </span><a href="mailto:lstewart@iweb.com" style="font-family:arial;font-size:small" target="_blank">lstewart@iweb.com</a><br>

</div><span style="font-family:arial;font-size:small">Lead Specialist, Abuse and Security Management</span><br style="font-family:arial;font-size:small"><span style="font-family:arial;font-size:small">Spécialiste principal, gestion des abus et sécurité</span><br style="font-family:arial;font-size:small">

<span style="font-family:arial;font-size:small"><a href="http://iweb.com" target="_blank">http://iweb.com</a> :: +1 (888) 909-4932</span><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>