<p><br></p>
<p>Ruslan from phone.<br>
22.04.2012 1:30 пользователь "Lee Wilson" <<a href="mailto:leefm40@yahoo.co.uk">leefm40@yahoo.co.uk</a>> написал:<br>
><br>
> On 16/04/2012 22:15, Ruslan Zakirov wrote:<br>
>><br>
>> On Mon, Apr 16, 2012 at 23:29, Lee Wilson<<a href="mailto:leefm40@yahoo.co.uk">leefm40@yahoo.co.uk</a>>  wrote:<br>
>>><br>
>>> Hi Ruslan,<br>
>>><br>
>>> Thanks for that. Looking at the perldoc for User.pm doesn't give any mention<br>
>>> of that but I guess it's inherited from Record.pm<br>
>><br>
>><br>
>> Right. In theory CFs can be on any object in the system, so methods<br>
>> are in Record.pm.<br>
>><br>
><br>
> <snip><br>
><br>
> 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.<br>

><br>
> 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:<br>
><br>
> 1) Requestor creates a ticket<br>
> 2) Upon the new ticket window loading, lookup the Account ID stored in the users custom field<br>
> 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.<br>
> 4) Store the id of the selected service into a hidden ticket custom field.<br>
><br>
> I've got a few more processes that I wish to get working but the basic process is the same.<br>
><br>
> 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:<br>
><br>
> % if ($CustomFields->First) {<br>
> Ok we've found some custom fields:<br /><br>
> % $CustomFields->GotoFirstItem;<br>
><br>
> <% $session{'CurrentUser'}->id %><br /> <-------- This Id displays fine<br>
> % while ( my $CustomField = $CustomFields->Next) {<br>
> <% loc($CustomField->Name) %> <------ Name of the custom field shows up<br>
> % $CustomField->Load($CustomField->Name);<br>
> <% $CustomField->ValuesForObject($session{'CurrentUser'}) %><br>
> <br /><br>
> % }<br>
> % }<br>
><br>
><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.<br>
></p>
<p>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.</p>
<p>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.<br></p>
<p>> Once again, thanks for all your help so far.<br>
><br>
><br>
> Lee<br>
> --------<br>
> List info: <a href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel</a><br>
</p>