[rt-users] checking/changing default queue for a user

Roman Massey romanmassey at gmail.com
Thu Jul 16 16:40:49 EDT 2015


Here’s a scrip I use for assigning queue depending on requestor email address. 

I stripped it down for you so this code is not tested. It runs through a hash so you can put multiple addresses corresponding to multiple queues. If you only need to do it for one address then you can eliminate the hash and while loop. The regex checks if the requestor email address contains the hash key. So you can put a full email address instead of just the domain.


Create a new scrip (condition: On Create, Action: User defined, Template: blank) and I applied it to our “INCOMING” queue which all tickets created by email go into.

Custom action preparation code:

# initialize vars
my $DestinationQueue;
my $RequestorEmail = $self->TicketObj->RequestorAddresses;

# map domains to queue name
my %DomainToQueueName = (
	'example.com' 	=> 'Example Queue',
	'example2.com' 	=> 'Example Queue #2',
	);

# iterate through dealership list and set the value to put in the CF
while ( my $Key = each %DomainToQueueName )
{
	if( $RequestorEmail=~ /\Q$Key/ ) {
		$DestinationQueue = $DomainToQueueName{$Key};
	}		
}

#set the queue
if($DestinationQueue) {
	my( $st, $msg ) = $self->TicketObj->SetQueue($DestinationQueue);
}

return 1;




-- 
Roman Massey

On July 15, 2015 at 5:50:27 PM, Aaron McCormack (aaron at backblaze.com) wrote:

Hi Boris,

Mixing bits of these two might get you on the right track with a scrip processing the ticket upon creation, I use something similar for regex matching patterns in subject lines and assigning to a specific queue.

http://requesttracker.wikia.com/wiki/SetOwnerAndQueueBySubject
http://requesttracker.wikia.com/wiki/AutomaticCustomFieldValue

Aaron


On Jul 14, 2015, at 2:18 PM, Boris Epstein <borepstein at gmail.com> wrote:

Hello listmates,

If I as an admin need to set a certain queue for requests originating from a user - how do I do that? Let us say I have a user John Smith, with an email of jsmith at abc.com. How do I make it so that every ticket by email coming from jsmith at abc.com goes into a certain queue.

Thanks.

Boris.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150716/bf42c27c/attachment.htm>


More information about the rt-users mailing list