[rt-users] Perl help

Ruslan Zakirov ruslan.zakirov at gmail.com
Tue May 26 19:12:35 EDT 2009


Once again, ALWAYS cc mailing list! Comments below.

On Wed, May 27, 2009 at 2:36 AM, Ken Crocker <kfcrocker at lbl.gov> wrote:
> Ruslan,
>
>
>     What? I don't understand your answer. Perhaps I didn't explain myself
> very well. Let me try again. I understand the principals, I just don't know
> what code or command or whatever (ie. LOOKs something like
> self->TransactionObj->Name(?)->EmailAddress(?) or however it would look) to

To call a method you need an object, so you can not do
...->Name->EmailAddress cuz ->Name usually returns a string.

> get the Id or Name of the user when all I have is the email address.  I'm

If you have an id, name or email then you can get other details about
record by constructing an object and loading it, for example:

my $user_obj = RT::User->new( $RT::SysteUser );
$user_obj->Load($id); # or $name or use another ->Load* method
unless ( $user_obj->id ) {
   ... error handling ...
}

$user_obj->EmailAddress;
$user_obj->Name;
$user_obj->id;
...


> adding ticket watchers. I don't want them to be added by email address, but
> by ID or name. I don't know how to code that command. I don't even know how
> to say it correctly, let alone write it, code it, whatever. I've seen code
> that looks like ($self->TransactionObj->CreatorObj->name; or
> $self->TransactionObj->CreatorObj->Id;). Does that make any sense?

If you're in an user defined scrip action then you can do above things.


>
> Kenn
> LBNL
>
> On 5/26/2009 2:27 PM, Ruslan Zakirov wrote:
>
> I think you miss concepts:
> * each user is principal
> * each group is principal
> * but three above are records in different tables
> * id of a user is equal to id of its principal record
> * the same applies to groups
> * in DB couldn't be a group with id equal to id of a user
>
> * every watcher is a user
> * id, name and email address are unique fields
> * because of this uniquenes AddWatcher methods can take email address
> as an argument
>
> On Wed, May 27, 2009 at 1:14 AM, Ken Crocker <kfcrocker at lbl.gov> wrote:
>
>
> Greetings,
>
>    I need to know how to take an email address (directly from an email
> header) and get the actual UserId/PrincipalId from RT. I have the
> address split out and now I just need an ID. I'm assuming that the
> PrincipalId is the same thing as the Name field from the USERS Table. In
> other words, I do NOT want to add an entire email address as a Ticket
> watcher, I want the Name field from the USers Table (ie. instead of
> KFCrocker at lbl.gov I want KFCrocker or whatever name correlates to
> KFCrocker at lbl.gov). Thank you in advance.
>
> Kenn
> LBNL
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
>
>
>



-- 
Best regards, Ruslan.



More information about the rt-users mailing list