I am attempting to check to see if a custom field has a value before
allowing a status change on a ticket. I have tried many ways of doing this
and I will post the code below.
This is going in to Ticket_Local.pm
package RT::Ticket;
use strict;
use Hook::LexWrap;
wrap ‘SetStatus’ => pre => &check_for_severity;
sub check_for_severity
{
my $self = shift;
my $cfValue = ->TicketObj->FirstCustomFieldValue(15);
if ($cfValue)
{
}
else
{
$_[-1] = [0,$self->loc('Ticket status can not be changed
with out a Severity Code’)];
}
}
1;
I have tried a few other ways as well but am unable to make this work. Any
advice?
That code has problems. For example, this:
my $cfValue = ->TicketObj->FirstCustomFieldValue(15);
should be:
my $cfValue = $self->TicketObj->FirstCustomFieldValue(15);
-ToddOn Tue, May 23, 2006 at 12:21:25PM -0500, Forquer, Brian R. wrote:
I am attempting to check to see if a custom field has a value before
allowing a status change on a ticket. I have tried many ways of doing this
and I will post the code below.
This is going in to Ticket_Local.pm
package RT::Ticket;
use strict;
use Hook::LexWrap;
wrap ‘SetStatus’ => pre => &check_for_severity;
sub check_for_severity
{
my $self = shift;
my $cfValue = ->TicketObj->FirstCustomFieldValue(15);
if ($cfValue)
{
}
else
{
$_[-1] = [0,$self->loc('Ticket status can not be changed
with out a Severity Code’)];
}
}
1;
I have tried a few other ways as well but am unable to make this work. Any
advice?
List info: The rt-devel Archives
Best Practical is hiring! Come hack Perl for us: Careers — Best Practical Solutions