[rt-users] Alternative GUIs for RT?

Vegard Vesterheim vegard.vesterheim at uninett.no
Wed Jun 1 07:13:53 EDT 2016


On Wed, 1 Jun 2016 12:01:10 +0200 Emmanuel Lacour <elacour at easter-eggs.com> wrote:

> Le 01/06/2016 11:53, Vegard Vesterheim a écrit :
>> 
>> 
>> I tried to register a new User Custom Field, naming the Field
>> 'PreferEditDisplay', and allowing two values for the field: 'Edit' or
>> 'Display'. I have registered the value 'Edit' for a specific user for
>> this Custom Field, but I am not able to extract the value
>> programmatically. I expected the following code to work, but I get no
>> values back.
>> 
>> my $UserObj = RT::User->new( $session{'CurrentUser'} );
>> my $cf_values = $UserObj->CustomFieldValues('PreferEditDisplay');
>> 
>
> You just wan't:
>
> my $cf_value = $UserObj->FirstCustomFieldValue('PreferEditDisplay');
>
> I think.

Yes, but I had tried that as well, same result.

I found a solution, I think the problem was related to loading the
correct User Object.

The following works:

my $UserObj = $session{'CurrentUser'}->UserObj;
my $cf_value = $UserObj->FirstCustomFieldValue('PreferEditDisplay');

I would have thought that
  RT::User->new($session{'CurrentUser'})
and
  $session{'CurrentUser'}->UserObj

would be equivalent, but apparently not.

Thanks for the hint.

-- 
- Vegard V -



More information about the rt-users mailing list