- I'm at Molly Malones http://4sq.com/gVJ9AB #
Category: All
All posts across the whole website belong to this category. They might also belong to some other categories as well, but this one holds all of them. Hence the descriptive name – All.
RT3 : Automatically assign owner by queue
There is one bit of functionality that I keep reusing for pretty much every installation of RT3 – automatic assignment of tickets to specific users based on queue. There are a few solutions to this problem and some are documented in RT3 wiki. But I always keep forgetting which solution to use and where I found it. So, in hopes not to ever spend more than 3 seconds searching for such a solution, I’m posting it here.
We’ll be using a global scrip instead of a per-queue scrip. This will simplify maintenance for those installations that use a lot of queues – you’ll need to change settings only in one place rather than all over the place. Create the new global scrip with the following settings:
- Description: AutoSetOwnerForQueue
- Condition: On Create
- Action: User Defined
- Template: Global Template : Blank
- Stage: TransactionCreate
- Custom condition: return 1;
- Custom action preparation code: return 1;
- Custom action cleanup code:
my %owners = (
'queue_name1' => 'username1',
'queue_name2' => 'username1',
'queue_name3' => 'username2',
);
my $QueueName = $self->TicketObj->QueueObj->Name;
return 1 unless defined($owners{$QueueName});
my $Actor = $self->TransactionObj->Creator;
return 1 if $Actor == $RT::SystemUser->id;
return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;
my $MyUser = $owners{$QueueName};
$RT::Logger->info("Auto assigning ticket #". $self->TicketObj->id ." to user $MyUser" );
my ($status, $msg) = $self->TicketObj->SetOwner( $MyUser );
unless( $status ) {
$RT::Logger->warning( "Impossible to assign the ticket to $MyUser: $msg" );
return undef;
}
1;
Last time I’ve used this was on RT 3.8.8. Adjust accordingly for the earlier and later versions.
Trailer : The Three Musketeers
Yet another take on “The Tree Musketeers”. It seems that with every other try there’s even more visual effects and even less common sense. I don’t know how they do it.
[youtube=http://www.youtube.com/watch?v=a82C8CLR2NE]
Day in brief
- git add evil_enemy && git commit -m "Murder" #
- The evening continues (@ Chester's) http://4sq.com/g6IAPJ #
