[rt-users] Scrip-Generation: OnOwnerChange --> Change Queue to one of the owner is granted to see

Ruslan Zakirov ruslan.zakirov at gmail.com
Wed May 20 17:10:43 EDT 2009


The easiest way is to use a perl hash:

my %map = (
  'user name A' => 'queue name',
  'user name B' => 'queue name',
  ...
);

Then you do something like this:

my $owner_name = $self->TicketObj->OwnerObj->Name;
my $new_queue_name = $map{ $owner_name };
unless ( $new_queue_name ) {
    $RT::Logger->error("No owner map for user $owner_name");
    return 0;
}

my ($status, $msg) = $self->TicketObj->SetQueue( $new_queue_name );
unless ( $status ) {
    $RT::Logger->error("Couldn't set queue to '$new_queue_name' of a
ticket #". $self->TicketObj->id . ": $msg");
    return 0;
}

I don't remember exactly if SetQueue method supports names, but
looking at your progress I think you can find way to load Queue by
name and get its id.

On Mon, May 18, 2009 at 12:29 PM, tommy0660 <flucht at wyeth.com> wrote:
>
> Hey!
>
> I have the following problem:
> If a ticket has been taken the owner AND the queue should change
> automatically. The queue should be one of those the owner is granted to see.
> Not every user is granted to see each queue. "Supporter A" for example is
> granted to see his queue "Development". If Supporter A takes a ticket, the
> queue should also change to Development. If an owner has rights to see more
> than one queue, i want to specifiy which queue it should be by my own
> hardcoded in the scrip (due to the fact, that this would only happen to
> three users, its not much work to do that.)
>
> So what i need is to find out:
>
> Who is the new owner of the ticket?
> Is the owner = Supporter A, Supporter B or Supporter C
> If yes:
>  If Supporter A:
>  Change Queue to "Queue 1";
>  If Supporter B:
>  and so on
> ...
> If no:
> Get the queue the owner is granted to see
> Change queue to this queue.
>
> I started without any knowledge about perl with the following scrip:
>
> #Get the new Owner of the ticket
> my $Owner = $self->TicketObj->Owner;
>
> #Here i tried to get the Owners Queue but I will get the Tickets Queue and
> thats wrong.
> ///my $Queue = $self->TicketObj->QueueObj->Name;
>
> #Set the Queue to $Queue
> my ($status, $msg) = $TicketObj->SetQueue ( $Queue );
> unless ( $status ) {
> die "Error: $msg";
> }
>
> Maybe someone can help me.
>
> Thx
> Best regards
> Tommy
> --
> View this message in context: http://www.nabble.com/Scrip-Generation%3A-OnOwnerChange---%3E-Change-Queue-to-one-of-the-owner-is-granted-to-see-tp23593199p23593199.html
> Sent from the Request Tracker - User mailing list archive at Nabble.com.
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>



-- 
Best regards, Ruslan.



More information about the rt-users mailing list