<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
<DIV>It works great with queue names as you coded it bellow!</DIV>
<DIV> </DIV>
<DIV>Thanks for your help!!</DIV>
<DIV> </DIV>
<DIV>Best regards,<BR>Tommy!<BR><BR>>>> Ruslan Zakirov <ruslan.zakirov@gmail.com> 2009-05-20 23:10:43 >>><BR></DIV>
<DIV style="COLOR: #000000">The easiest way is to use a perl hash:<BR><BR>my %map = (<BR>  'user name A' => 'queue name',<BR>  'user name B' => 'queue name',<BR>  ...<BR>);<BR><BR>Then you do something like this:<BR><BR>my $owner_name = $self->TicketObj->OwnerObj->Name;<BR>my $new_queue_name = $map{ $owner_name };<BR>unless ( $new_queue_name ) {<BR>    $RT::Logger->error("No owner map for user $owner_name");<BR>    return 0;<BR>}<BR><BR>my ($status, $msg) = $self->TicketObj->SetQueue( $new_queue_name );<BR>unless ( $status ) {<BR>    $RT::Logger->error("Couldn't set queue to '$new_queue_name' of a<BR>ticket #". $self->TicketObj->id . ": $msg");<BR>    return 0;<BR>}<BR><BR>I don't remember exactly if SetQueue method supports names, but<BR>looking at your progress I think you can find way to load Queue by<BR>name and get its id.<BR><BR>On Mon, May 18, 2009 at 12:29 PM, tommy0660 <flucht@wyeth.com> wrote:<BR>><BR>> Hey!<BR>><BR>> I have the following problem:<BR>> If a ticket has been taken the owner AND the queue should change<BR>> automatically. The queue should be one of those the owner is granted to see.<BR>> Not every user is granted to see each queue. "Supporter A" for example is<BR>> granted to see his queue "Development". If Supporter A takes a ticket, the<BR>> queue should also change to Development. If an owner has rights to see more<BR>> than one queue, i want to specifiy which queue it should be by my own<BR>> hardcoded in the scrip (due to the fact, that this would only happen to<BR>> three users, its not much work to do that.)<BR>><BR>> So what i need is to find out:<BR>><BR>> Who is the new owner of the ticket?<BR>> Is the owner = Supporter A, Supporter B or Supporter C<BR>> If yes:<BR>>  If Supporter A:<BR>>  Change Queue to "Queue 1";<BR>>  If Supporter B:<BR>>  and so on<BR>> ...<BR>> If no:<BR>> Get the queue the owner is granted to see<BR>> Change queue to this queue.<BR>><BR>> I started without any knowledge about perl with the following scrip:<BR>><BR>> #Get the new Owner of the ticket<BR>> my $Owner = $self->TicketObj->Owner;<BR>><BR>> #Here i tried to get the Owners Queue but I will get the Tickets Queue and<BR>> thats wrong.<BR>> ///my $Queue = $self->TicketObj->QueueObj->Name;<BR>><BR>> #Set the Queue to $Queue<BR>> my ($status, $msg) = $TicketObj->SetQueue ( $Queue );<BR>> unless ( $status ) {<BR>> die "Error: $msg";<BR>> }<BR>><BR>> Maybe someone can help me.<BR>><BR>> Thx<BR>> Best regards<BR>> Tommy<BR>> --<BR>> View this message in context: <A href="http://www.nabble.com/Scrip-Generation%3A-OnOwnerChange---%3E-Change-Queue-to-one-of-the-owner-is-granted-to-see-tp23593199p23593199.html">http://www.nabble.com/Scrip-Generation%3A-OnOwnerChange---%3E-Change-Queue-to-one-of-the-owner-is-granted-to-see-tp23593199p23593199.html</A><BR>> Sent from the Request Tracker - User mailing list archive at Nabble.com.<BR>><BR>> _______________________________________________<BR>> <A href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</A><BR>><BR>> Community help: <A href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</A><BR>> Commercial support: sales@bestpractical.com<BR>><BR>><BR>> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.<BR>> Buy a copy at <A href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</A><BR>><BR><BR><BR><BR>-- <BR>Best regards, Ruslan.<BR></DIV></BODY></HTML>