[rt-users] Check if Custom Field is empty?

Matt Zagrabelny mzagrabe at d.umn.edu
Wed Aug 24 10:10:32 EDT 2016


On Wed, Aug 24, 2016 at 6:17 AM, PeterMairGO <PeterMairGO at gmail.com> wrote:
> Hello,
> I'm scripting a custom condition before a email will be sent.
> I've tryed this: ($self->TicketObj->FirstCustomFieldValue('Solution') =!
> 'NULL')

Unfortunately, at a minimum, your perl is wrong. You were looking for
'!=', not '=!'. However with strings you want 'ne' instead of '!='.
The latter is for numeric comparisons.

my $a = 'Hi';

if ($a ne 'Goodbye') {
    print "Good.\n";

Some more things...

What version of RT are you running?

I would try a little script like this to test things out:


use strict;
use warnings;

use lib qw(

use RT -init;
my $t = RT::Ticket->new(RT->SystemUser);


my $cf = $t->FirstCustomFieldValue('Solution');

if (defined $cf) {
    print "$cf\n";
else {
    print "__NOT_DEFINED__\n";


More information about the rt-users mailing list