After some more playing around and search it now seems to be fixed permenantly (I hope at least lol)<br><br>This scrip does what I want it to do:<br><br style="font-family: courier new,monospace;"><blockquote><span style="font-family: courier new,monospace;">my $actor_id = $self->TransactionObj->Creator;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">my $temp_user = RT::User->new();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$temp_user->Load($actor_id);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">my $actor_name = $temp_user->Name();</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$self->TicketObj->AddCustomFieldValue(Field => 'Ticket Solver', Value => $actor_name);</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">my ($code, $msg) = $self->TicketObj->SetOwner(6, 'Force');</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">return 1;</span><br></blockquote>This seems to get the actioning user from the transaction, then via some magic I've found in the wiki it gets the name and afterwards it fills in the name into the Ticket Solver field.<br>
<br>After that, it simply sets the owner to nobody.<br><br>This wiki page helped me out:<br><br><ul><li><a href="http://requesttracker.wikia.com/wiki/AutoCcLastOwner">http://requesttracker.wikia.com/wiki/AutoCcLastOwner</a></li>
</ul><br>Hope this helps someone else in the end :-)<br><br><br clear="all">-- Bart<br>
<br><br><div class="gmail_quote">2011/10/5 Bart <span dir="ltr"><<a href="mailto:bart@pleh.info">bart@pleh.info</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>Hi,</div><div><br></div><div>After some more testing the below scrip doesn't seem to do what it should..</div><div><br></div><div>It now does work but it fills in the wrong user. Sometimes a colleague of mine instead of myself, while I'm the person hitting "Resolved". Or sometimes root, I guess because it runs a scrip when closing and the actual last actioning user almost always is root.</div>

<div><br></div><div>Is there better, more clever, way for getting the actioning user "or" the ticket owner into a CF during ticket resolve and afterwards setting the owner to nobody?</div><div><div></div><div class="h5">
<div><br></div><br clear="all">
-- Bart<br>
<br><br><div class="gmail_quote">2011/10/4 Bart <span dir="ltr"><<a href="mailto:bart@pleh.info" target="_blank">bart@pleh.info</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Never mind...<div><br></div><div>I just stumbled upon the CreatorObj.</div><div><br></div><div>Changed the scrip to the following:</div><div><br></div><div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">


<font face="'courier new', monospace">my $my_owner = $self->TicketObj->CreatorObj->Name;<div><br>$self->TicketObj->AddCustomFieldValue(Field => 'Last Owner', Value => $my_owner);<br>

my ($code, $msg) = $self->TicketObj->SetOwner(6, 'Force');<br>return 1;</div></font></blockquote></div><div><br></div><div>This gave me the result I wanted it to have :-)</div><div><br></div><div>Problem solved.</div>


<div><div><br></div><div><font color="#888888"><br clear="all">-- Bart</font><div><div></div><div><br>
<br><br><div class="gmail_quote">2011/10/4 Bart <span dir="ltr"><<a href="mailto:bart@pleh.info" target="_blank">bart@pleh.info</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Hi,<div><br></div><div>I'm currently struggling with this scrip, in separate parts it works but together it kinda makes a mess O_o</div><div><br></div><div><div>Some background on the scrip. We want the ticket owner to be set to Nobody on close, when tickets reopen they will show up in the New/nobody queue for everyone in a support group to pickup instead of the previous owner.</div>



<div>But, we do want the ability to make a simple search query on resolved tickets and sort them by owner. Basically for our managers so they can see if the tickets are distributed evenly, etc.</div><div>For that purpose I figured I could fill in the owner name into a CF and have the actual owner set to nobody.</div>



</div><div><br></div><div>Below the scrip:</div><div><br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">



<font face="'courier new', monospace">my $my_owner = $self->TicketObj->OwnerObj->Name;<br>$self->TicketObj->AddCustomFieldValue(Field => 'Last Owner', Value => $my_owner);<br>
my ($code, $msg) = $self->TicketObj->SetOwner(6, 'Force');<br>return 1;</font></blockquote><div><br></div><div>What happens is that the first two lines fill the current owner's name into a CF called "Last Owner".</div>



<div>After that it should change the owner to Nobody, in my case the UID of Nobody is number 6. I've set it to force since it doesn't always work correctly if you leave the force bit out.</div><div><br></div><div>



When I run this scrip separately it works, I can set the owner to nobody + if I leave the last bit out I'm able to set the current owner in the CF called "Last Owner".</div><div>But when using them together as shown in the scrip above it doesn't work the way I want it to.</div>



<div><br></div><div>It then seems to first set the owner to nobody and then fill the CF with the username Nobody... So yes it works but I'm expecting the scrip to first get the old owner name and fill that one into the CF.</div>



<div><br></div><div>I've also tried setting this first part into the "prep" code and the second part (changing the owner) into the cleanup code, but that doesn't seem to change anything.</div><div>The other thing I've tried was changing the TransactionBatch to TransactionCreate and back. With TransactionCreate it doesn't fully work, when using TransactionBatch it does work but instead of the previous ticket owner it fills in the Nobody user...</div>



<div><br></div><div>So, does anyone know a simple way to fix this? I'm expecting RT to sequentially do the above scrip but I guess I'm missing something in order for it to work.</div><div><br></div><div>Thanks in advance.</div>



<div><br></div><font color="#888888"><div><br clear="all">-- Bart</div>
</font></blockquote></div><br></div></div></div></div>
</blockquote></div><br>
</div></div></blockquote></div><br>