Easily assigning "requestor" a username rather than an email

Since this question requires a little bit of background, I’m going to state
the question itself as simply as possible before I get into the back-story.

Q: How can I easily make the “requestor” of a ticket a user other than
myself, without necessarily knowing that user’s email address? Secondary to
that, is it possible to search through tickets by a requestor’s username
rather than by his email address?

If this makes sense as is, read no further. If not, you can see why I’m
asking below:

The way we have our RT set up is such that our clients are set up as users
in the system. They can each login, search tickets, create tickets, etc.
However, they also call us quite frequently. When they call us, an internal
support staff member will create a new ticket, and change the requestor from
himself to the client’s email address as listed in their “Edit User” form.
Unfortunately, its obviously a lot easier to ask a caller “What is your
company name?” (which we use as their username) than it is to say “What
email address to you have on file with us?”. So it would be awesome if the
person fielding the call could just pop in a username rather than having to
find the email address associated with that username.

Also, I’d like to be able to search through tickets by providing a
requestor’s username rather than his email address. Right now, the search
criteria only has “(Requestor’s|CC’s|AdminCC’s) email address
(contains|doesn’t contain) __________”. I’m wondering if any of you guys
have come up with an easier way to search through tickets by a requesting
user rather than by a requesting user’s email address.

Thanks a bunch for taking the time to help out.

Jonathan Reeder

I think there are some places in RT where LoadByEmail is called and
it should probably just be Load(). User_Overlay::Load() should
be changed to:

sub Load {
my $self = shift;
my $identifier = shift || return undef;

#if it's an int, load by id. otherwise, load by name.
if ( $identifier =~ /^\d+$/ ) {
    $self->SUPER::LoadById($identifier);
}
elsif ($identifier =~ /\@/) {
    $self->LoadByEmail( $identifier );
}
else {
    $self->LoadByCol( "Name", $identifier );
}

}On Tue, Jan 11, 2005 at 11:21:49AM -0600, Jonathan Reeder wrote:

Since this question requires a little bit of background, I’m going to state
the question itself as simply as possible before I get into the back-story.

Q: How can I easily make the “requestor” of a ticket a user other than
myself, without necessarily knowing that user’s email address? Secondary to
that, is it possible to search through tickets by a requestor’s username
rather than by his email address?

If this makes sense as is, read no further. If not, you can see why I’m
asking below:

The way we have our RT set up is such that our clients are set up as users
in the system. They can each login, search tickets, create tickets, etc.
However, they also call us quite frequently. When they call us, an internal
support staff member will create a new ticket, and change the requestor from
himself to the client’s email address as listed in their “Edit User” form.
Unfortunately, its obviously a lot easier to ask a caller “What is your
company name?” (which we use as their username) than it is to say “What
email address to you have on file with us?”. So it would be awesome if the
person fielding the call could just pop in a username rather than having to
find the email address associated with that username.

Also, I’d like to be able to search through tickets by providing a
requestor’s username rather than his email address. Right now, the search
criteria only has “(Requestor’s|CC’s|AdminCC’s) email address
(contains|doesn’t contain) __________”. I’m wondering if any of you guys
have come up with an easier way to search through tickets by a requesting
user rather than by a requesting user’s email address.

Thanks a bunch for taking the time to help out.

Jonathan Reeder


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com

What version of RT are you running? I’m not sure about the ticket
creation side of things, but the ticket query builder in our
installation definitely lets you search on (Requestor|CC|AdminCC)
(Name|Realname|Nickname|EmailAddress|etc). We’re running 3.4.0rc5, but
I’m pretty sure that’s been there since at least 3.2.2…

You’re absolutely right. My apologies, I was still running 3.0.12. Now if
I can just figure out how to create the tickets with a username as requestor
instead of email address, I’ll be all set. Thanks a bunch for the heads-up.

Cool, this sounds very promising. I’m a bit unindoctrinated though, so
you’ll have to excuse me. Is this going to allow me to put a username in
the “Requestor” field, then when I save the ticket, it will automatically
assign that user’s email address to the “Requestor” field?

Thanks a bunch.From: Todd Chapman [mailto:rt@chaka.net]
Sent: Tuesday, January 11, 2005 11:40 AM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Easily assigning “requestor” a username rather
than an email

I think there are some places in RT where LoadByEmail is called and
it should probably just be Load(). User_Overlay::Load() should
be changed to:

sub Load {
my $self = shift;
my $identifier = shift || return undef;

#if it's an int, load by id. otherwise, load by name.
if ( $identifier =~ /^\d+$/ ) {
    $self->SUPER::LoadById($identifier);
}
elsif ($identifier =~ /\@/) {
    $self->LoadByEmail( $identifier );
}
else {
    $self->LoadByCol( "Name", $identifier );
}

}

Since this question requires a little bit of background, I’m going to
state
the question itself as simply as possible before I get into the
back-story.

Q: How can I easily make the “requestor” of a ticket a user other than
myself, without necessarily knowing that user’s email address? Secondary
to
that, is it possible to search through tickets by a requestor’s username
rather than by his email address?

If this makes sense as is, read no further. If not, you can see why I’m
asking below:

The way we have our RT set up is such that our clients are set up as users
in the system. They can each login, search tickets, create tickets, etc.
However, they also call us quite frequently. When they call us, an
internal
support staff member will create a new ticket, and change the requestor
from
himself to the client’s email address as listed in their “Edit User” form.
Unfortunately, its obviously a lot easier to ask a caller “What is your
company name?” (which we use as their username) than it is to say “What
email address to you have on file with us?”. So it would be awesome if
the
person fielding the call could just pop in a username rather than having
to
find the email address associated with that username.

Also, I’d like to be able to search through tickets by providing a
requestor’s username rather than his email address. Right now, the search
criteria only has “(Requestor’s|CC’s|AdminCC’s) email address
(contains|doesn’t contain) __________”. I’m wondering if any of you guys
have come up with an easier way to search through tickets by a requesting
user rather than by a requesting user’s email address.

Thanks a bunch for taking the time to help out.

Jonathan Reeder


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com

Yes.On Tue, Jan 11, 2005 at 12:51:41PM -0600, Jonathan Reeder wrote:

Cool, this sounds very promising. I’m a bit unindoctrinated though, so
you’ll have to excuse me. Is this going to allow me to put a username in
the “Requestor” field, then when I save the ticket, it will automatically
assign that user’s email address to the “Requestor” field?

Thanks a bunch.

-----Original Message-----
From: Todd Chapman [mailto:rt@chaka.net]
Sent: Tuesday, January 11, 2005 11:40 AM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Easily assigning “requestor” a username rather
than an email

I think there are some places in RT where LoadByEmail is called and
it should probably just be Load(). User_Overlay::Load() should
be changed to:

sub Load {
my $self = shift;
my $identifier = shift || return undef;

#if it's an int, load by id. otherwise, load by name.
if ( $identifier =~ /^\d+$/ ) {
    $self->SUPER::LoadById($identifier);
}
elsif ($identifier =~ /\@/) {
    $self->LoadByEmail( $identifier );
}
else {
    $self->LoadByCol( "Name", $identifier );
}

}

On Tue, Jan 11, 2005 at 11:21:49AM -0600, Jonathan Reeder wrote:

Since this question requires a little bit of background, I’m going to
state
the question itself as simply as possible before I get into the
back-story.

Q: How can I easily make the “requestor” of a ticket a user other than
myself, without necessarily knowing that user’s email address? Secondary
to
that, is it possible to search through tickets by a requestor’s username
rather than by his email address?

If this makes sense as is, read no further. If not, you can see why I’m
asking below:

The way we have our RT set up is such that our clients are set up as users
in the system. They can each login, search tickets, create tickets, etc.
However, they also call us quite frequently. When they call us, an
internal
support staff member will create a new ticket, and change the requestor
from
himself to the client’s email address as listed in their “Edit User” form.
Unfortunately, its obviously a lot easier to ask a caller “What is your
company name?” (which we use as their username) than it is to say “What
email address to you have on file with us?”. So it would be awesome if
the
person fielding the call could just pop in a username rather than having
to
find the email address associated with that username.

Also, I’d like to be able to search through tickets by providing a
requestor’s username rather than his email address. Right now, the search
criteria only has “(Requestor’s|CC’s|AdminCC’s) email address
(contains|doesn’t contain) __________”. I’m wondering if any of you guys
have come up with an easier way to search through tickets by a requesting
user rather than by a requesting user’s email address.

Thanks a bunch for taking the time to help out.

Jonathan Reeder


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com

This is not the cleanest way to do it but it is the easiest.

Create /opt/rt3/local/lib/RT/User_Local.pm with this content:

no warnings qw(redefine);

sub LoadByEmail {
my $self = shift;
my $address = shift;

# Never load an empty address as an email address.
unless ($address) {
    return (undef);
}

if ($address !~ /\@/) {
    $self->Load($address) && return $self;
}
$address = $self->CanonicalizeEmailAddress($address);

#$RT::Logger->debug("Trying to load an email address: $address\n");
return $self->LoadByCol( "EmailAddress", $address );

}

You may need to restart Apache.

-ToddOn Tue, Jan 11, 2005 at 12:51:41PM -0600, Jonathan Reeder wrote:

Cool, this sounds very promising. I’m a bit unindoctrinated though, so
you’ll have to excuse me. Is this going to allow me to put a username in
the “Requestor” field, then when I save the ticket, it will automatically
assign that user’s email address to the “Requestor” field?

Thanks a bunch.

-----Original Message-----
From: Todd Chapman [mailto:rt@chaka.net]
Sent: Tuesday, January 11, 2005 11:40 AM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Easily assigning “requestor” a username rather
than an email

I think there are some places in RT where LoadByEmail is called and
it should probably just be Load(). User_Overlay::Load() should
be changed to:

sub Load {
my $self = shift;
my $identifier = shift || return undef;

#if it's an int, load by id. otherwise, load by name.
if ( $identifier =~ /^\d+$/ ) {
    $self->SUPER::LoadById($identifier);
}
elsif ($identifier =~ /\@/) {
    $self->LoadByEmail( $identifier );
}
else {
    $self->LoadByCol( "Name", $identifier );
}

}

On Tue, Jan 11, 2005 at 11:21:49AM -0600, Jonathan Reeder wrote:

Since this question requires a little bit of background, I’m going to
state
the question itself as simply as possible before I get into the
back-story.

Q: How can I easily make the “requestor” of a ticket a user other than
myself, without necessarily knowing that user’s email address? Secondary
to
that, is it possible to search through tickets by a requestor’s username
rather than by his email address?

If this makes sense as is, read no further. If not, you can see why I’m
asking below:

The way we have our RT set up is such that our clients are set up as users
in the system. They can each login, search tickets, create tickets, etc.
However, they also call us quite frequently. When they call us, an
internal
support staff member will create a new ticket, and change the requestor
from
himself to the client’s email address as listed in their “Edit User” form.
Unfortunately, its obviously a lot easier to ask a caller “What is your
company name?” (which we use as their username) than it is to say “What
email address to you have on file with us?”. So it would be awesome if
the
person fielding the call could just pop in a username rather than having
to
find the email address associated with that username.

Also, I’d like to be able to search through tickets by providing a
requestor’s username rather than his email address. Right now, the search
criteria only has “(Requestor’s|CC’s|AdminCC’s) email address
(contains|doesn’t contain) __________”. I’m wondering if any of you guys
have come up with an easier way to search through tickets by a requesting
user rather than by a requesting user’s email address.

Thanks a bunch for taking the time to help out.

Jonathan Reeder


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com

Worked like a charm! Thanks a bunch for the help.From: Todd Chapman [mailto:rt@chaka.net]
Sent: Tuesday, January 11, 2005 1:03 PM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Easily assigning “requestor” a username rather
than an email

This is not the cleanest way to do it but it is the easiest.

Create /opt/rt3/local/lib/RT/User_Local.pm with this content:

no warnings qw(redefine);

sub LoadByEmail {
my $self = shift;
my $address = shift;

# Never load an empty address as an email address.
unless ($address) {
    return (undef);
}

if ($address !~ /\@/) {
    $self->Load($address) && return $self;
}
$address = $self->CanonicalizeEmailAddress($address);

#$RT::Logger->debug("Trying to load an email address: $address\n");
return $self->LoadByCol( "EmailAddress", $address );

}

You may need to restart Apache.

-Todd

Cool, this sounds very promising. I’m a bit unindoctrinated though, so
you’ll have to excuse me. Is this going to allow me to put a username in
the “Requestor” field, then when I save the ticket, it will automatically
assign that user’s email address to the “Requestor” field?

Thanks a bunch.

-----Original Message-----
From: Todd Chapman [mailto:rt@chaka.net]
Sent: Tuesday, January 11, 2005 11:40 AM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Easily assigning “requestor” a username rather
than an email

I think there are some places in RT where LoadByEmail is called and
it should probably just be Load(). User_Overlay::Load() should
be changed to:

sub Load {
my $self = shift;
my $identifier = shift || return undef;

#if it's an int, load by id. otherwise, load by name.
if ( $identifier =~ /^\d+$/ ) {
    $self->SUPER::LoadById($identifier);
}
elsif ($identifier =~ /\@/) {
    $self->LoadByEmail( $identifier );
}
else {
    $self->LoadByCol( "Name", $identifier );
}

}

Since this question requires a little bit of background, I’m going to
state
the question itself as simply as possible before I get into the
back-story.

Q: How can I easily make the “requestor” of a ticket a user other than
myself, without necessarily knowing that user’s email address?
Secondary
to

that, is it possible to search through tickets by a requestor’s username
rather than by his email address?

If this makes sense as is, read no further. If not, you can see why I’m
asking below:

The way we have our RT set up is such that our clients are set up as
users

in the system. They can each login, search tickets, create tickets,
etc.

However, they also call us quite frequently. When they call us, an
internal
support staff member will create a new ticket, and change the requestor
from
himself to the client’s email address as listed in their "Edit User"
form.

Unfortunately, its obviously a lot easier to ask a caller “What is your
company name?” (which we use as their username) than it is to say “What
email address to you have on file with us?”. So it would be awesome if
the
person fielding the call could just pop in a username rather than having
to
find the email address associated with that username.

Also, I’d like to be able to search through tickets by providing a
requestor’s username rather than his email address. Right now, the
search

criteria only has “(Requestor’s|CC’s|AdminCC’s) email address
(contains|doesn’t contain) __________”. I’m wondering if any of you
guys

have come up with an easier way to search through tickets by a
requesting

user rather than by a requesting user’s email address.

Thanks a bunch for taking the time to help out.

Jonathan Reeder


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com

That’s along the exact same lines of what I was thinking of doing. Would
you mind too terribly sending me the code you’ve got for that? I’m sure I
could whip it up in short order, but its always nice to see how someone else
has tackled it too.

Thanks a bunch.

Jonathan

[mailto:rt-users-bounces@lists.bestpractical.com]On Behalf Of Matt
HanleySent: Wednesday, January 12, 2005 7:57 AM
To: rt-users@lists.bestpractical.com
Subject: RE: [rt-users] Easily assigning “requestor” a username rather
than an email

address, I’ll be all set. Thanks a bunch for the heads-up.

Not to confuse you with another option, but we ran into the same problem
here. Since we have a known set of users, we prepopulate the Requestor
field with a drop down list that’s generated from an SQL query. The
displayed value is the full name and the value passed to RT is the email
address. No typing, no confusion.

-matt

Matthew Hanley
mhanley@cxtec.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Be sure to check out the RT wiki at http://wiki.bestpractical.com

Bringing this one up from the past, it worked great! Thank you!