[rt-users] Recording user/requestor attributes in ticket custom fields
Kevin Falcone
falcone at bestpractical.com
Thu Feb 17 12:09:06 EST 2011
On Thu, Feb 17, 2011 at 05:04:30PM -0000, Peter Nugent wrote:
> Hi Kevin,
>
> Thanks for replying so quickly I've read docs/templates.pod and now have
> the requestor email address in the being returned in the mail. I'm not
> so hot on the code though I just copied, pasted and swopped a few
> obvious variables. I'm a bit lost when you say
>
> "You should be checking the return values of AddValueForObject.
> my ($ok, $msg) = $CF_Obj etc etc"
>
> How do I even start to go about doing that? I've started to try teach
> myself some basic Perl am I on the right track?
The line you quoted was me showing you how to check the return values.
Warn them out in an $RT::Logger->error() call
-kevin
>
>
> -----Original Message-----
> From: rt-users-bounces at lists.bestpractical.com
> [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Kevin
> Falcone
> Sent: 17 February 2011 15:52
> To: rt-users at lists.bestpractical.com
> Subject: Re: [rt-users] Recording user/requestor attributes in ticket
> custom fields
>
> On Thu, Feb 17, 2011 at 10:35:58AM -0000, Peter Nugent wrote:
> > Hi all,
> >
> >
> >
> > I'm running RT 3.8.7 on Ubuntu 10.04 for a couple of months now so
> am fairly comfortable with
> > the basics. I'd like to be able to record requestor info in custom
> fields with a ticket so
> > that when an engineer is assigned the ticket this info can be part
> of the summary mailed to
> > them.
> >
> >
> >
> > I've read that I can do this via a scrip and already have custom
> fields being set to default
> > values but I can't figure out what objects(Is this the correct
> term?) to set my user info
> > custom field to?
> >
> >
> >
> > What I'm asking is pretty much the same as here
> > [1]http://www.gossamer-threads.com/lists/rt/users/98591 but I
> rather not use the callbacks
> > just yet - I'd like to get my head around scrips and
> objects/variables first.
> >
> >
> >
> > I found the code below and modified it slightly I can't remember
> its original function or
> > where I found it for that matter but it was similar to what I was
> after - I think!
> > Unfortunately I'm not getting anything stored in the Custom Field
>
> You should be checking the return values of AddValueForObject.
> my ($ok, $msg) = $CF_Obj etc etc
> also, review docs/templates.pod for more about what info you can get at
> in Templates
>
> -kevin
>
> > my $T_Obj = $self->TicketObj;
> >
> > my $requestor_address = $T_Obj->RequestorAddresses;
> >
> > my $cf_value;
> >
> > my $CF_Obj = RT::CustomField->new($self->CurrentUser);
> >
> > my $cf_name = "CSM Name"; #change this to the CF name
> >
> >
> >
> > $requestor_address =~ /(^.+)@([^\.].*\.[a-z]{2,}$)/;
> >
> > $cf_name = $1
> >
> > $CF_Obj->LoadByName( Name => $cf_name,);
> >
> > $RT::Logger->debug( "Loaded \$CF_Obj->Name = ". $CF_Obj->Name()
> > ."\n" );
> >
> > $CF_Obj->AddValueForObject( Object => $self->TicketObj,Content =>
> > $cf_value, );
> >
> > return 1;
> >
> >
> >
> >
> >
> > Can someone point me in the right direction is the code I'm using
> even close?
> >
> >
> >
> > Thanks in advance and let me know if you need more info,
> >
> > Peter
> >
> >
> >
> >
> >
> > Peter Nugent | Technical Director | +353 (0) 45-531262 | +353 (0)
> > 45-940522
> >
> > Leinster Mills | Osberstown | Naas | Co. Kildare | Ireland |
> [2]peter.nugent at hetg.ie |
> > [3]www.hetg.ie
> >
> >
> >
> >
> > ----------------------------------------------------------------------
> > ------------------------
> >
> > Hibernia Computer Services (KILDARE) T/A Hibernia Evros Technology
> Group Registered in Ireland
> > No. 425932
> > Registered Office: Block G, Cherrywood Science & Technology Park,
> > Loughlinstown, Co. Dublin
> >
> >
> >
> >
> >
> > References
> >
> > Visible links
> > 1. http://www.gossamer-threads.com/lists/rt/users/98591
> > 2. mailto:peter.nugent at hetg.ie
> > 3. http://www.hetg.ie/
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110217/6f9afb18/attachment.sig>
More information about the rt-users
mailing list