Re: [rt-users] Code to get list of a custom field's values (almost there)

2015-07-03 Thread Roman Massey
Thanks Barton!

That wasn’t exactly what I wanted but it helped me figure it out! btw I had to 
capitalize Dumper in “print Dumper $client;” for it to work. But seeing 
everything that came out of the “dumper” let me know the innards of the 
RT::CustomFieldValue.

The code I ended up using:

my $clientcustomfield = RT::CustomFieldValues-new($RT::SystemUser);
$clientcustomfield-LimitToCustomField(45);

my $clients = $clientcustomfield;

while (my $client = $clients-Next ) {
print $client-Name;
print \n;
}

—
Roman Massey

 On Jul 2, 2015, at 7:41 AM, Barton Chittenden bar...@bywatersolutions.com 
 wrote:
 
 In this case, $client is a reference to a hash. You can't print it directly, 
 but you can print the contents using Data::Dumper.
 
 I think this should work:
 
 use Data::Dumper;
 my $clientcustomfield = RT::CustomFieldValues-new($RT::SystemUser);
 $clientcustomfield-LimitToCustomField(45);
 
 my $clients = $clientcustomfield;
 
 while (my $client = $clients-Next ) {
 print dumper $client;
 print \n;
 }
 
 
 
 On Wed, Jul 1, 2015 at 10:23 PM, Roman Massey romanmas...@gmail.com 
 mailto:romanmas...@gmail.com wrote:
 Hi Guys, Looking for some advice on a script to fetch list of a custom 
 field’s values. At the moment it’s printing 
 RT::CustomFieldValue=HASH(0x91f22b0)”. I’m obviously missing something silly 
 and would really appreciate a guru’s touch!
 
 my $clientcustomfield = RT::CustomFieldValues-new($RT::SystemUser);
 $clientcustomfield-LimitToCustomField(45);
 
 my $clients = $clientcustomfield;
 
 while (my $client = $clients-Next ) {
 print $client;
 print \n;
 }
 
 
 —
 Roman Massey
 
 



Re: [rt-users] Code to get list of a custom field's values (almost there)

2015-07-02 Thread Barton Chittenden
In this case, $client is a reference to a hash. You can't print it
directly, but you can print the contents using Data::Dumper.

I think this should work:

use Data::Dumper;
my $clientcustomfield = RT::CustomFieldValues-new($RT::SystemUser);
$clientcustomfield-LimitToCustomField(45);

my $clients = $clientcustomfield;

while (my $client = $clients-Next ) {
print dumper $client;
print \n;
}



On Wed, Jul 1, 2015 at 10:23 PM, Roman Massey romanmas...@gmail.com wrote:

 Hi Guys, Looking for some advice on a script to fetch list of a custom
 field’s values. At the moment it’s
 printing RT::CustomFieldValue=HASH(0x91f22b0)”. I’m obviously missing
 something silly and would really appreciate a guru’s touch!

 my $clientcustomfield = RT::CustomFieldValues-new($RT::SystemUser);
 $clientcustomfield-LimitToCustomField(45);

 my $clients = $clientcustomfield;

 while (my $client = $clients-Next ) {
 print $client;
 print \n;
 }


 —
 Roman Massey