[rt-users] I forgot how to do this

Mathew Snyder theillien at yahoo.com
Thu Aug 9 14:37:00 EDT 2007


I figured it out.  I knew that something had to be doing what I was asking
because if I need to alter a custom field, all of the values are populated into
the Modify.html file.  Looking at that I discovered that I needed to use the
ValuesObj method of CustomField.  That said, I have this:

#!/usr/bin/perl

use warnings;
use strict;
use lib '/usr/local/rt3/lib';
use lib '/usr/local/rt3/local/lib';
use RT;
use RT::Users;
use RT::CustomFieldValues;

RT::LoadConfig(); ## Loading RT config
RT::Init(); ## Initialise RT

my $cf_id = 1;

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

my $cfVals = $cf->ValuesObj;

while (my $cfVal = $cfVals->Next){
    print $cfVal->Name . "\n";
}

This gives me the output I was expecting from the get go.

I appreciate all of the input and thoughts.  They actually pushed me in the
direction I needed to go even if they weren't the answer on a silver platter :)

Keep up with me and what I'm up to: http://theillien.blogspot.com


Roy El-Hames wrote:
> Ok hold on I just looked at your code, what are you looking for the
> different values you have set for one custom field ;
> ie 1-  you have your Enviroment cf as a select one/multi value cf with
> different options and you are looking for the different options ??
> or 2-  are you looking for the values of the Enviromnet cf that have
> been set by the users on the different tickets ??
> 
> RT::CustomFieldValues used for 1
> RT::ObjectCustomFieldValues used for 2 (but sorry still can't find the
> function that may help you)
> 
> Roy
> 



More information about the rt-users mailing list