[rt-users] getting at custom fields in tickets

Craig Stevenson stevensc at nsuok.edu
Wed Nov 16 18:00:02 EST 2005


Hi All!

I have been struggling today tring to get a hold of  the custom fields 
that are associated with my tickets in a particluar queue.  I can get to 
the RT::ObjectCustomFieldValues,  but cannot step back to 
RT::ObjectCustomFielfdValue!  How to proceed?  I have a toy script below 
to see what I am talking about. 

Thank you very much.  This group does good things for me.

---script---
#!/usr/local//rt/perl/bin/perl -w

use strict;

use lib "/usr/local/rt/lib";
use RT::Interface::CLI qw(CleanEnv);

use RT::Ticket;

RT::LoadConfig();
RT::Init();

my$ret;
my$msg;

my$tObj = new RT::Ticket($RT::SystemUser);

# I have a ticket and need to update the custom fields
# I can locate a RT::ObjectCustomFieldValues object
# in the ticket, but cannot get back to the interface
# that allows me to change the content, the
# RT::ObjectCustomFieldValue object!.

# How to proceed?

my $eId = 1; # ticket number Id

$ret=$tObj->Load($eId);
print "this ticket exists: $ret\n";

my$cfObj = $tObj->CustomFieldValues('Room');
print "cfObj = $cfObj\n";
($ret,$msg) = $cfObj->SetContent('101');
print "(ret,msg) = ($ret)($msg)\n";
---- output ----
cfObj = RT::ObjectCustomFieldValues=HASH(0xa2e133c)
[Wed Nov 16 22:55:19 2005] [crit]: Can't locate object method 
"SetContent" via package "RT::ObjectCustomFieldValues" at 
./rt-set-tickets-test.pl line 33.
 (/usr/local/rt/lib/RT.pm:295)
---- end of output -----

-- 
Craig Stevenson
|| stevensc at nsuok.edu | 918-456-5511x5955
|| Northeastern State University
|| 601 N. Grand | Tahlequah, Oklahoma 74464-2399





More information about the rt-users mailing list