[rt-devel] Getting Custom Fields for a User

Ruslan Zakirov ruz at bestpractical.com
Mon Apr 16 10:25:20 EDT 2012


On Sun, Apr 15, 2012 at 23:21, Lee Wilson <leefm40 at yahoo.co.uk> wrote:
> On 15/04/2012 20:07, Thomas Sibley wrote:
>>
>> RT::Queue-RT::User isn't a valid LookupType.  It's just RT::User.  See
>> the top of RT::CustomField for the valid types (or the html of the
>> Create CF admin page).
>>
>> Thomas
>
>
>
> Thanks for the quick response Thomas, bit too liberal copying on my part
> there.
>
> I've removed the LookupType filter completely but stil not getting any
> records returned or any errors generated?

If you have user object then you can just call my $cfs = $user->CustomFIelds;.
You can take a look at CustomFIelds method in lib/RT/Record.pm.

Even if you don't have user object then create one:

my $cfs = RT::User->new( RT->SystemUser )->CustomFields;

Use $session{CurrentUser} instead of SystemUser if it's web interface and
you want to respect ACLs.

> --------
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel

-- 
Best regards, Ruslan.


More information about the rt-devel mailing list