Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Users

Lookup of Requestor Custom Field

 

 

Request Tracker users RSS feed   Index | Next | Previous | View Threaded


jkperla at ucdavis

Apr 24, 2012, 2:59 PM

Post #1 of 3 (470 views)
Permalink
Lookup of Requestor Custom Field

I have a request to create a scrip that will automatically assign an owner to a ticket based on the requestor's assigned Purchaser.

I have a Global custom field Purchaser, assigned to all Users.
Select one value.
For each value, Name is the username of the Purchaser, and Description is their full name (to make things easy for the managers).

So far my attempts to get the value of the custom field have ended in failure, mostly with
[error]: Impossible to assign the ticket to : That user does not exist ((eval 1502):10)

My current script is below. Am I missing something obvious here? I've been up and down the PODs and I'm not finding a fix for this.

PREP
return 1;


CLEANUP:
#Get requestor
my $Reqstr_Obj = $self->TicketObj->Requestors;
# get value of custom field, which should be user ID of newowner
my $newowner = $self->TransactionObj->CreatorObj->_Value('Purchaser');
$RT::Logger->error( $newowner );

#set the owner
my ($status, $msg) = $self->TicketObj->SetOwner( $newowner );
unless( $status ) {
$RT::Logger->error( "Impossible to assign the ticket to $newowner: $msg" );
return undef;
}
return 1;

-----
Jourdan Perla
BFTV Admin Group (BAE/FST/TEX/VEN)
University of California, Davis
530-752-3065


ruslan.zakirov at gmail

Apr 24, 2012, 10:22 PM

Post #2 of 3 (427 views)
Permalink
Re: Lookup of Requestor Custom Field [In reply to]

You need FirstCustomFieldValue method instead of _Value.

Ruslan from phone.
25.04.2012 1:59 пользователь "Jourdan Perla" <jkperla [at] ucdavis> написал:

> I have a request to create a scrip that will automatically assign an
> owner to a ticket based on the requestor’s assigned Purchaser.****
>
> ** **
>
> I have a Global custom field Purchaser, assigned to all Users.****
>
> Select one value.****
>
> For each value, Name is the username of the Purchaser, and Description is
> their full name (to make things easy for the managers).****
>
> ** **
>
> So far my attempts to get the value of the custom field have ended in
> failure, mostly with ****
>
> [error]: Impossible to assign the ticket to : That user does not exist
> ((eval 1502):10)****
>
> ** **
>
> My current script is below. Am I missing something obvious here? I’ve been
> up and down the PODs and I’m not finding a fix for this.****
>
> ** **
>
> PREP****
>
> return 1;****
>
> ** **
>
> ** **
>
> CLEANUP:****
>
> #Get requestor****
>
> my $Reqstr_Obj = $self->TicketObj->Requestors;****
>
> # get value of custom field, which should be user ID of newowner****
>
> my $newowner = $self->TransactionObj->CreatorObj->_Value('Purchaser');****
>
> $RT::Logger->error( $newowner );****
>
> ** **
>
> #set the owner****
>
> my ($status, $msg) = $self->TicketObj->SetOwner( $newowner );****
>
> unless( $status ) {****
>
> $RT::Logger->error( "Impossible to assign the ticket to $newowner:
> $msg" );****
>
> return undef;****
>
> }****
>
> return 1;****
>
> ** **
>
> -----****
>
> Jourdan Perla****
>
> BFTV Admin Group (BAE/FST/TEX/VEN)****
>
> University of California, Davis****
>
> 530-752-3065****
>
> ** **
>


jkperla at ucdavis

Apr 26, 2012, 1:55 PM

Post #3 of 3 (421 views)
Permalink
Re: Lookup of Requestor Custom Field [In reply to]

That did it. Thanks!

From: Ruslan Zakirov [mailto:ruslan.zakirov [at] gmail]
Sent: Tuesday, April 24, 2012 10:23 PM
To: Jourdan Perla
Cc: rt-users [at] lists
Subject: Re: [rt-users] Lookup of Requestor Custom Field


You need FirstCustomFieldValue method instead of _Value.

Ruslan from phone.
25.04.2012 1:59 пользователь "Jourdan Perla" <jkperla [at] ucdavis<mailto:jkperla [at] ucdavis>> написал:
I have a request to create a scrip that will automatically assign an owner to a ticket based on the requestor’s assigned Purchaser.

I have a Global custom field Purchaser, assigned to all Users.
Select one value.
For each value, Name is the username of the Purchaser, and Description is their full name (to make things easy for the managers).

So far my attempts to get the value of the custom field have ended in failure, mostly with
[error]: Impossible to assign the ticket to : That user does not exist ((eval 1502):10)

My current script is below. Am I missing something obvious here? I’ve been up and down the PODs and I’m not finding a fix for this.

PREP
return 1;


CLEANUP:
#Get requestor
my $Reqstr_Obj = $self->TicketObj->Requestors;
# get value of custom field, which should be user ID of newowner
my $newowner = $self->TransactionObj->CreatorObj->_Value('Purchaser');
$RT::Logger->error( $newowner );

#set the owner
my ($status, $msg) = $self->TicketObj->SetOwner( $newowner );
unless( $status ) {
$RT::Logger->error( "Impossible to assign the ticket to $newowner: $msg" );
return undef;
}
return 1;

-----
Jourdan Perla
BFTV Admin Group (BAE/FST/TEX/VEN)
University of California, Davis
530-752-3065

Request Tracker users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.