Listing valid values in RT Custom Field

Just wondering if anyone has come across a similar issue.
We have been trying to update a custom field on ticket creation.

We have managed to succeed in updating the field based on the domain name of the requestor. However we would like to validate the domain against all of the values in the custom field.
As you can see from the code below that we have attempted to get the values from the “Client” custom field. However our while loop doesn’t work.

my $cf = RT::CustomField->new($RT::SystemUser);

my $cf_name = ‘Client’;

$cf->LoadByName(Name => $cf_name);

my $values = $cf->Values;

while ( my $v = $values->Next ) {

check if $v matches the domain.


return 1;

If any one can offer assistance with this that would be great.



$cf->LoadByName(Name => $cf_name);

You didn’t check that you actually loaded custom field:

unless ( $cf->id ) {
die “Couldn’t load CF $cf_name”;

Best regards, Ruslan.