To all,
I'm trying to pre-set a ticket owner based on the value of an incoming
CF that is set during ticket creation. What I have is this
Condition: On Create
Action: User-Defined
Template: Blank
Stage: TransactionBatch
Custom Action Prep Code:
my $ticket = $self->TicketObj;
return unless ($ticket->OwnerObj->Name() eq ‘Nobody’ );
Custom Action Cleanup Code:
set up variables
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $org = $ticket->FirstCustomFieldValue(‘CF Name’)
condition setting owner ID on value of CF CF Name
if ($org = ‘XXX’)
{
$ticket->SetOwner->Name(‘Persons User Name1’, ‘Force’);
}
elseif ($org = ‘XY XY’)
{
$ticket->SetOwner->Name(‘Persons User Name2’, ‘Force’);
}
return 1;
The ticket owner is not being set. The ticket is created and all other
fields, including the CF, are being created.
Any ideas? Thanks.
Kenn
LBNL
Kenn,
Custom Action Prep Code:
my $ticket = $self->TicketObj;
return unless ($ticket->OwnerObj->Name() eq ‘Nobody’ );
You’ll need to return 1 if you want to continue to action cleanup, 0
otherwise.
Custom Action Cleanup Code:
$ticket->SetOwner->Name('Persons User Name1', 'Force');
I think this should work:
$ticket->SetOwner (‘Persons User Name1’, ‘Force’);
Steve
Stephen Turner
Senior Programmer/Analyst - SAIS
MIT IS&T
[forwarding to list]
Stephen,
I thought that "return unless" defaulted to "return 1 unless", but I
changed it anyway.
I tried your "set" code and that didn't work. Any other ideas?
Kenn
LBNLOn 10/27/2008 12:44 PM, Stephen Turner wrote:
Kenn,
On Mon, 27 Oct 2008 15:35:40 -0400, Kenneth Crocker KFCrocker@lbl.gov wrote:
Custom Action Prep Code:
my $ticket = $self->TicketObj;
return unless ($ticket->OwnerObj->Name() eq ‘Nobody’ );
You’ll need to return 1 if you want to continue to action cleanup, 0
otherwise.
Custom Action Cleanup Code:
$ticket->SetOwner->Name('Persons User Name1', 'Force');
I think this should work:
$ticket->SetOwner (‘Persons User Name1’, ‘Force’);
Steve
Hi!
I thought that "return unless" defaulted to "return 1 unless", but I
changed it anyway.
If you don’t define a value, it is undefined. There is a special value
named ‘undef’ in Perl just for that. It evaluates to zero on numeric
comparison, and false on boolean.
I tried your "set" code and that didn't work. Any other ideas?
if ($org = ‘XXX’)
You probably want to compare two strings with “$org eq ‘XXX’” rather
than set $org’s value to ‘XXX’, which is what “=” does.
Cheers,
Kalle Hallivuori +358-41-5053073 http://korpiq.iki.fi/