[rt-users] Pulling CustomFieldValues

Mathew Snyder theillien at yahoo.com
Wed Nov 22 03:35:19 EST 2006


I'm trying to pull together a script which will print out all the values from a
particular CF.  It will work in conjunction with a bit of code already provided
to me by Roy El-Hames.

I think I've figured out that I need to use RT::CustomFieldValues in order to
make use of the LimitToCustomField subroutine.  What I can't figure out is how
to pass the name of the CF to the subroutine.  Being a perl novice this eludes me.

This is what I have so far:

#!/usr/bin/perl
use lib "/usr/local/rt-3.6.1/lib";
use RT;
use RT::Users ; ## you may not need this but what the he
use RT::CustomFieldValues;
use RT::Interface::CLI qw(CleanEnv);
use warnings;

CleanEnv();   ##Cleaning the env
RT::LoadConfig();   ## Loading RT config
RT::Init();    ## Initialise RT

my $users = new RT::Users(RT::SystemUser);
$users->LimitToPrivileged;
my $CustomField = new RT::CustomFieldValues(Profiles);
$CustomField->LimitToCustomField;

while ( $user = $users->Next) {
   next if $user->Name eq "root";
   print $user->Name . "\n";
}
exit;

Can someone help me out and point me in the right direction?

Thanks,
Mathew



More information about the rt-users mailing list