How to Assign a value to a Custom Field using Requestor Real Name

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@umbc.edu

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@umbc.edu

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
LBNLOn Wed, Feb 9, 2011 at 11:08 AM, Joe Kirby (gmail) kirby@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@umbc.edu

RT::CustomField->new( $QueueObj->*??Requestor.RealName??

$self->TicketObj->Requestors->UserMembersObj->First->RealName

returns only the first requestor of the ticket if there is more than one
requestor…

Thank You very much

JoeOn 2/22/2011 12:00 PM, rt-users-request@lists.bestpractical.com wrote:

How to Assign a value to a Custom Field
using Requestor Real Name

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@umbc.edu