[rt-users] How to access User custom fields in code?

Trask Rogers trask at lyris.com
Fri Jul 1 19:29:43 EDT 2005


I am trying to figure out how to write / read custom fields for users.  
I see there are some functions related to custom fields in 
Transaction_Overlay.pm, Ticket_Overlay.pm and Queue_Overlay.pm but 
there isn't something specific for users.

Was ObjectCustomField created as a more generic form of custom fields?  

A pointer in the right direction or a snippet of code would be greatly 
appreciated.


Here is something I started with.  It is code I have to extract the 
value from a particular ticket custom field:

    my $CustomFields = $Ticket->CustomFields;
    while (my $CustomField = $CustomFields->Next()) {
        if ($CustomField->Name eq 'FOOid') {
            my $Values = $Ticket>CustomFieldValues($CustomField->Id);  
            my $Value = $Values->Next();
            $FOOid = $Value->Content if defined $Value;
            last;
        }
    }


Note: This doesn't seem all that efficient or elegant, but it is how I 
got it to work.  Recommendations for better methods are always 
appreciated.

Thanks.

----------------------
Trask Rogers
Technical Support Engineer
Lyris Technologies, Inc.




More information about the rt-users mailing list