[Rt-devel] Hook::Lexwrap and Custom Fields

Forquer, Brian R. brian.forquer at sca.com
Tue May 23 13:21:25 EDT 2006


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?


More information about the Rt-devel mailing list