Re: [rt-users] Look up User by Attribute in Scrip

2012-10-26 Thread Thomas Sibley

On 10/26/2012 04:52 PM, Ram wrote:

Hey folks,
I'm writing a scrip to help us manage our voicemails in RT. The
voicemails arrive via email as attachments and the extension of the
recipient is the only distinguishing characteristic in the email. How
can I load an RT user in a script given only their work telephone?


You want the LoadByCols method provided by DBIx::SearchBuilder::Record.

my $user = RT::User->new( RT->SystemUser );
$user->LoadByCols( WorkPhone => "1234" );

if ($user->id) {
# loaded!
} else {
# couldn't find that user...
}

Note that WorkPhone isn't forced to be unique, so you should make sure 
that you keep it unique if you're going to load by it.


We're hiring! http://bestpractical.com/jobs


Re: [rt-users] Look up User by Attribute in Scrip

2012-10-27 Thread Ram
> On 10/26/2012 04:52 PM, Ram wrote:
>> Hey folks,
>> I'm writing a scrip to help us manage our voicemails in RT. The
>> voicemails arrive via email as attachments and the extension of the
>> recipient is the only distinguishing characteristic in the email. How
>> can I load an RT user in a script given only their work telephone?
>
> You want the LoadByCols method provided by DBIx::SearchBuilder::Record.
>
> my $user = RT::User->new( RT->SystemUser );
> $user->LoadByCols( WorkPhone => "1234" );
>
> if ($user->id) {
>  # loaded!
> } else {
>  # couldn't find that user...
> }
>
> Note that WorkPhone isn't forced to be unique, so you should make sure
> that you keep it unique if you're going to load by it.

Awesome, thanks!! Yep our phone extensions are unique so it'll be fine.
ram

We're hiring! http://bestpractical.com/jobs


Re: [rt-users] Look up User by Attribute in Scrip

2012-10-27 Thread k...@rice.edu
On Fri, Oct 26, 2012 at 04:52:37PM -0700, Ram wrote:
> Hey folks,
> I'm writing a scrip to help us manage our voicemails in RT. The
> voicemails arrive via email as attachments and the extension of the
> recipient is the only distinguishing characteristic in the email. How
> can I load an RT user in a script given only their work telephone?
> thanks!
> ram

Hi Ram,

You will need to lookup their phone number in a table that has their
user information. Here this is all available in our campus LDAP directory
so some simple Net::LDAP calls can be used for this. It could also pull
the information from an RT custom field for the user as well.

Cheers,
Ken

We're hiring! http://bestpractical.com/jobs


Re: [rt-users] Look up User by Attribute in Scrip

2012-11-01 Thread Ram
> Date: Sat, 27 Oct 2012 13:14:22 -0500
> From: "k...@rice.edu" 
> To: Ram 
> Cc: rt-users@lists.bestpractical.com
> Subject: Re: [rt-users] Look up User by Attribute in Scrip
> Message-ID: <20121027181422.ga21...@aart.rice.edu>
> Content-Type: text/plain; charset=us-ascii
>
> On Fri, Oct 26, 2012 at 04:52:37PM -0700, Ram wrote:
>> Hey folks,
>> I'm writing a scrip to help us manage our voicemails in RT. The
>> voicemails arrive via email as attachments and the extension of the
>> recipient is the only distinguishing characteristic in the email. How
>> can I load an RT user in a script given only their work telephone?
>> thanks!
>> ram
>
> Hi Ram,
>
> You will need to lookup their phone number in a table that has their
> user information. Here this is all available in our campus LDAP directory
> so some simple Net::LDAP calls can be used for this. It could also pull
> the information from an RT custom field for the user as well.
>

Thanks, but as you probably saw I was actually looking for the RT
search method back into the RT user definition.
cheers,
ram

We're hiring! http://bestpractical.com/jobs