Checking/changing default queue for a user

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@abc.com. How do I make it so that every ticket by email
coming from jsmith@abc.com goes into a certain queue.

Thanks.

Boris.

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@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@abc.com mailto:jsmith@abc.com. How do I make it so that every ticket by email coming from jsmith@abc.com mailto:jsmith@abc.com goes into a certain queue.

Thanks.

Boris.

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 MasseyOn July 15, 2015 at 5:50:27 PM, Aaron McCormack (aaron@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@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@abc.com. How do I make it so that every ticket by email coming from jsmith@abc.com goes into a certain queue.

Thanks.

Boris.

Roman, Aaron, thanks!

The code looks pretty good and I am sure this is one way to get the job
done.

But what I am wondering is this. Even without any scrips - effectively,
triggers performing custom functions for a particular user of set of users

  • the queue gets set up somehow. Then the questions becomes, how? And why
    can this not be just a default setting? For instance, if I have two
    companies that I provide IT services to, say, “Alpha Motors” and “Bravo
    Tires” with a queue dedicated to each one why can’t I just assign every
    Alpha user to the Alpha queue and every Bravo user to the Bravo queue just
    through the configuration menu? Not saying a feature like this has to exist
    already - I personally failed to find it - but it seems like it would make
    sense for it to exist.

Cheers,

Boris.On Thu, Jul 16, 2015 at 4:40 PM, Roman Massey romanmassey@gmail.com wrote:

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@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@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@abc.com. How do I make it so that every ticket by email
coming from jsmith@abc.com goes into a certain queue.

Thanks.

Boris.

Hello again,

And just to add to the confusion here:

http://kb.mit.edu/confluence/display/istcontrib/Setting+your+Default+Queue+in+Request+Tracker

Apparently, a setting is indeed supposed to exist to set this parameter.
But I for the life of me can not find it! Where did it go? :slight_smile:

Any and all help appreciated as always.

Cheers,

Boris.On Tue, Jul 14, 2015 at 5:18 PM, Boris Epstein borepstein@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@abc.com. How do I make it so that every ticket by email
coming from jsmith@abc.com goes into a certain queue.

Thanks.

Boris.

Hello again,

And just to add to the confusion here:

Setting your Default Queue in Request Tracker - IS&T Contributions - Hermes

Apparently, a setting is indeed supposed to exist to set this parameter.
But I for the life of me can not find it! Where did it go? :slight_smile:

Any and all help appreciated as always.

Cheers,

Boris.

Hi Boris,

The option is a per-user configuration setting in their Preferences. It may be
scrip(t)able with the RT API.

Regards,
Ken

Ken,

Thanks!

I could not find it in the settings.

However, it turned out that there was a scrip doing the job - universally,
for all users. Which actually makes more sense to me than trying to do it
on a user-by-user basis.

There was some issue with the code in that scrip so I fixed it temporarily
for now for now - and am contemplating better fixes as a permanent solution.

The fix is “On Create” and is run for all newly created tickets - including
the ones emailed in. It is structured along the following lines:

my $queuename = “”;
my $email = ($self->TicketObj->RequestorAddresses)[0];
my $user = RT::User->new($RT::SystemUser);
$user->LoadByEmail($email);
die “Couldn’t load user by email” unless $user->id;

followed by the logic that sets the queue depending upon who the user is.

Thanks once again to everybody for their assistance.

Cheers,

Boris.On Tue, Jul 21, 2015 at 2:57 PM, ktm@rice.edu ktm@rice.edu wrote:

Hi Boris,

The option is a per-user configuration setting in their Preferences. It
may be
scrip(t)able with the RT API.

Regards,
Ken