[rt-users] How to Assign a value to a Custom Field using Requestor Real Name

Kenneth Crocker kfcrocker at lbl.gov
Thu Feb 10 13:43:53 EST 2011


Joe,

I'm curious why you want a report in a User's home page that would show
tickets *requested by other users* because their last name uses the same
letter (ie. CF with A - G). Why not just have a report that shows all
non-resolved tickets for which they are the Requestor? That would certainly
be easier to write and set up.

Just a thought.

Kenn
LBNL

On Wed, Feb 9, 2011 at 11:08 AM, Joe Kirby (gmail) <kirby at umbc.edu> wrote:

>  My users would like to have reports on their RT-at-a-Glance page which
> would parse out their tickets from several queues into a report grouped by
> the requestors initial of their last name.
>
> For example group 1 may be A-F, Group 2 G-K, etc.
>
> I was thinking of having a Custom Field associated with their queues that
> was set at time of entry and then have the report use that value in this
> field (A-Z) to select records
>
> My problem is that I do not know the field name for the Requestors Real
> Name as indicated in the ?? marks below.
>
> Additionally, I am VERY open if someone has a better idea.
>
> Below is the script I was going to have exec at New Ticket entry
>
> Any help is greatly appreciated
>
> Thanks
>
> Joe
>
>  my $CFName = 'Last Name Grouping';
> my $RecTransaction = 1;
>
>
>   my $QueueObj = $self->TicketObj->QueueObj;
>   my $CFObj = RT::CustomField->new( $QueueObj->*??Requestor.RealName?? *);
>   $CFObj->LoadByNameAndQueue( Name => $CFName, Queue => $QueueObj->id );
>   unless( $CFObj->id ) {
>     $RT::Logger->warning("custom field '$CFName' isn't defined for queue
> '". $QueueObj->Name ."'");
>     return undef;
>   }
>
>
>
>   my $RequestorRealName = '*??Requestor.RealName??*';
>   my $LastInitial = substr($RequestorRealName ,instr($RequestorRealName ,'
> ',-1,1)+1,1);
>
>   unless( $self->TicketObj->FirstCustomFieldValue( $CFObj->id ) ) {
>     my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue(
>                                           Field => $CFObj->id,
>                                           Value => $LastInitial,
>                                           RecordTransaction =>
> $RecTransaction );
>     unless( $st ) {
>       $RT::Logger->warning( "Couldn't set $DefaultValue as value for CF
> $CFName:". $msg );
>       return undef;
>     }
>   }
>
>   return 1;
>
> --
> Joe Kirby , Assistant Vice President, Business Systems
> Division of Information Technology (DoIT)
> Support Response - http://www.umbc.edu/oit
> Administration 627
> Office - 410-455-3020
> Email - kirby at umbc.edu
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110210/2c1e5421/attachment.htm>


More information about the rt-users mailing list