[rt-users] Read requestor user CF and write the value into a ticket CF

Bart bart at pleh.info
Wed Oct 5 10:53:09 EDT 2011


If I were to use the UserObj, how would that look?

I find it difficult to make the transition from requestor e-mail address to
used ID and from there to a users custom field O_o

As for the More about requestors box, we like the default usage lol + we
want the ability to make reports/charts based on the value of the tickets
Organisation field.

-- Bart


2011/10/5 Kevin Falcone <falcone at bestpractical.com>

> On Wed, Oct 05, 2011 at 09:08:37AM -0500, ktm at rice.edu 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
>
> --------
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20111005/111977b8/attachment.htm>


More information about the rt-users mailing list