[rt-users] Scrip for Default Owners

Roedel, Mark MarkRoedel at letu.edu
Wed Mar 30 15:30:24 EST 2005


I do this with queue-specific scrips, rather than a single global one.
Here's an example scrip action:


#Custom action preparation code
return 1;

#Custom action cleanup code
if( $self->TicketObj->OwnerObj->Name =~ /Nobody/i ) {
  my ($status, $msg) = $self->TicketObj->SetOwner( 'MarkRoedel' );
  unless( $status ) {
    $RT::Logger->warning("Failed to assign owner: " . $msg);
    return undef;
  }
}
return 1;


--
Mark Roedel
Web Programmer / Analyst
LeTourneau University



-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com
[mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Dave
Edwards
Sent: Wednesday, March 30, 2005 12:52 PM
To: rt-users at bestpractical.com
Subject: [rt-users] Scrip for Default Owners

I'm working on a scrip that I hope will allow new tickets to be
assigned to a default owner per queue.  What I have so far is not
causing trouble, but neither is it working -- the owner remains
Nobody.  Here it is. (On Create, User Defined with template
Transaction.)

# Custom action preparation code
return 1;

# Custom action cleanup code
my $ticket = $self->TicketObj;

my $ticketsQueue = $ticket->QueueObj->id;

# map the numeric IDs of each Queue to a default owner
my %defaultOwners = (
                   # Queue   => user                   
   '3' => '22',    # Foo     => bob
   '4' => '26',    # Bar     => carole
   '5' => '28',    # Fud     => ted
   '1' => '10',    # General => alice
);

# if owner of this new ticket is Nobody
if ($ticket->Owner eq '10') {
    # change the owner from Nobody to default for this queue
    $ticket->SetOwner($defaultOwners[$ticketsQueue]);
    return 1;
}
else {
    return undef;
}
-----

What have I done wrong here?

Thanks,
Dave.
-- 
Dave Edwards <dle&sympatico,ca>
Freelance and Technical Writer,
With Special Interest in Open Source Software
http://bigStory.homelinux.org



More information about the rt-users mailing list