On Wed, Oct 05, 2011 at 09:08:37AM -0500, [email protected] wrote: > On Wed, Oct 05, 2011 at 03:31:32PM +0200, Bart wrote: > > Hi, > > > > For users we've added an extra CF which is an autocomplete field containing > > a list of roughly 450 organisations that we work with. We had to make a > > separate CF for this in order to help our users a little, saves typo's and > > makes adding an organisation to a user easy. So basically we're ignoring the > > RT default Organisation field and have a separate CF for this purpose. > > > > The second thing we now want is to show that organisation name (the one in > > the organisation CF) in our tickets, so that we can make nice reports based > > on that information. > > This is where I'm stuck, I can't seem to figure out how to read the CF for a > > requestor (or any user) and thus am unable to write the value into a ticket > > CF. > > > > I know how to read and write into ticket CF's, but I have no clue on how to > > read information from a requestor of a ticket. > > > > Reading information from a tidcket CF: > > > > $self->TicketObj->FirstCustomFieldValue('Custom Field Name'); > > > > Writing information into a ticket CF: > > > > $self->TicketObj->AddCustomFieldValue(Field => 'Custom Field Name', Value => > > $my_owner); > > > > Or, instead of a variable use a fixed value between single quotes. > > > > I also know that this piece of code gets a ticket requestor e-mail address: > > > > my $requestor_address = $self->TicketObj->RequestorAddresses; > > > > But thats about as far as I'm able to get.... > > > > Can anyone point me in the right direction for this one? > > > > > > -- Bart > > Hi Bart, > > If I am understanding your question, you want to be able to script > reading/writing User custom fields. It happens that I have hit the > same stumbling block. It is easy to update Ticket custom fields, but > I would like to do the same with User CFs. The only thing that looks > like it would work is RT::Record, ugh. I hope that someone has a > better option... patch for REST, the RT CLI...? Any help would be > appreciated.
Have you tried FirstCustomFieldValue or AddCustomFieldValue on a User object? They're RT::Record methods, and thus available on all RT objects (although it only makes sense on the ones that have CFs applied). RT4 also allows customization of the More about Requestors box from the config using Formats so you can just display the User CF directly rather than copying. -kevin
pgpON5ZJOd9pE.pgp
Description: PGP signature
-------- RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 & 19, 2011 * Washington DC, USA October 31 & November 1, 2011 * Barcelona, Spain November 28 & 29, 2011
