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

Reply via email to