Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Devel
Re: Getting Custom Fields for a User
 

Index | Next | Previous | View Flat


ruslan.zakirov at gmail

Apr 21, 2012, 8:53 PM


Views: 1087
Permalink
Re: Getting Custom Fields for a User [In reply to]

Ruslan from phone.
22.04.2012 1:30 пользователь "Lee Wilson" <leefm40 [at] yahoo> написал:
>
> On 16/04/2012 22:15, Ruslan Zakirov wrote:
>>
>> On Mon, Apr 16, 2012 at 23:29, Lee Wilson<leefm40 [at] yahoo> wrote:
>>>
>>> Hi Ruslan,
>>>
>>> Thanks for that. Looking at the perldoc for User.pm doesn't give any
mention
>>> of that but I guess it's inherited from Record.pm
>>
>>
>> Right. In theory CFs can be on any object in the system, so methods
>> are in Record.pm.
>>
>
> <snip>
>
> Thanks for the detailed reply Ruslan it's really helped me understand
things. In the meantime I've read about the RT:SystemUSer which may do
things more like I want to as all I need to be able to do is get the values
for the users custom fields when creating/editing a ticket.
>
> I'm now a bit stuck on how to retrieve the values for the custom fields.
Perhaps if I explain more what I'm trying to do someone be so kind as to
explain the bit i've missed/got wrong:
>
> 1) Requestor creates a ticket
> 2) Upon the new ticket window loading, lookup the Account ID stored in
the users custom field
> 3) Based on the Account ID display a list of services (stored in a
seperate database/CRM) in a dropdown <-- got this bit working independently
just not with RT.
> 4) Store the id of the selected service into a hidden ticket custom field.
>
> I've got a few more processes that I wish to get working but the basic
process is the same.
>
> So far I've got as far as coding the following test routine is
MassageCustomFields but can't get it to show the values of the associated
current user:
>
> % if ($CustomFields->First) {
> Ok we've found some custom fields:<br />
> % $CustomFields->GotoFirstItem;
>
> <% $session{'CurrentUser'}->id %><br /> <-------- This Id displays fine
> % while ( my $CustomField = $CustomFields->Next) {
> <% loc($CustomField->Name) %> <------ Name of the custom field shows up
> % $CustomField->Load($CustomField->Name);
> <% $CustomField->ValuesForObject($session{'CurrentUser'}) %>
> <br />
> % }
> % }
>
>
> On the last line it returns a reference to 'RT::ObjectCustomFieldValues'
but I can't figure out how to get the currently selected/filled in value.
>

First of all every object has CustomFieldValues method that return the same
thing. So after getting name of a CF you can call it on
§session{CurrentUser}->UserObj.

ObjectCustomFieldValues is just another collection you walk with Next and
while loop. If you know for sure that all fields are single value then you
can use FirstCustomFieldValue.

> Once again, thanks for all your help so far.
>
>
> Lee
> --------
> List info:
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel

Subject User Time
Getting Custom Fields for a User leefm40 at yahoo Apr 15, 2012, 11:59 AM
    Re: Getting Custom Fields for a User trs at bestpractical Apr 15, 2012, 12:07 PM
        Re: Getting Custom Fields for a User leefm40 at yahoo Apr 15, 2012, 12:21 PM
            Re: Getting Custom Fields for a User ruz at bestpractical Apr 16, 2012, 7:25 AM
    Re: Getting Custom Fields for a User leefm40 at yahoo Apr 16, 2012, 12:29 PM
        Re: Getting Custom Fields for a User ruz at bestpractical Apr 16, 2012, 2:15 PM
    Re: Getting Custom Fields for a User leefm40 at yahoo Apr 21, 2012, 2:30 PM
        Re: Getting Custom Fields for a User ruslan.zakirov at gmail Apr 21, 2012, 8:53 PM
    Re: Getting Custom Fields for a User leefm40 at yahoo Apr 22, 2012, 2:52 PM
        Re: Getting Custom Fields for a User falcone at bestpractical Apr 24, 2012, 9:38 AM
    Re: Getting Custom Fields for a User leefm40 at yahoo Apr 27, 2012, 11:38 AM
        Re: Getting Custom Fields for a User leefm40 at yahoo Apr 27, 2012, 11:41 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.