Problem extracting custom field values

Hi there:

I’m writing a little piece of code to avoid storing duplicate values in
custom fields.
The custom field in reference is of ‘multiple values’ type.

I do the following:

my $CFValues = $Ticket->CustomFieldValuesAsString($cf_name);

if ($CFValues=~/$val/ms) {
# do not save the cf value
}
else {
# save the cf value
}

What’s really weird is if the custom field currently has one value,
the code above seems to be completely ignored. If there’s more than
one value, it does exactly what i need it to do.

This happens when it runs in a callback i wrote which is called by
‘Ticket/Update.html’

When i run the same snippet in a cli script it works always.

I’m totally clueless about what is causing this situation, after spending
countless hours i haven’t solved this problem.

Any help will be greatly appreciated

Hugo Escobar

[image: AFS_logo.png]

Follow us on Facebook and Linked-In

[image: facebook-24x24.png]http://www.facebook.com/pages/Miami-FL/ASSOCIATION-FINANCIAL/64952991864
[image: linkedin-24x24.png] http://www.linkedin.com/companies/1006276

I’m writing a little piece of code to avoid storing duplicate values in
custom fields.
The custom field in reference is of ‘multiple values’ type.

RT shouldn’t store duplicate values.

Best regards, Ruslan.