[rt-users] Recording user/requestor attributes in ticket custom fields
Kevin Falcone
falcone at bestpractical.com
Thu Feb 17 10:51:33 EST 2011
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/3160e83a/attachment.sig>
More information about the rt-users
mailing list