Customfields create

RT-ers:

I am attempting to write a script that will allow me to build the custom
fields for tickets in a particular queue. I am using the CLI rather
than the web interface. The table that hold this data is CUSTOMFIELDS.
This means I want to work with RT::CustomField.

I am running into trouble with a create. To my mind the following
should kick back a useable ID but it does not.
------------script--------------------------
#!/usr/local/rt/perl/bin/perl -w

use strict;

use lib “/usr/local/rt/lib”;
use RT::Interface::CLI qw(CleanEnv);
use RT::CustomField;

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

my$Obj = new RT::CustomField($RT::SystemUser);

my($code,$msg) = $Obj->Create(Name=>“test”);
print “(code,msg) = ($code),($msg)\n”;
my$id = $Obj->Id();
print “id=($id)\n”;
------------output--------------------------
(code,msg) = (0),()
id=()
------------done--------------------------
Any pointers here would be very appreciated. Thanks! Enjoy your weekend…

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

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

use strict;

use lib qw( /usr/local/rt/lib );
use RT;
use RT::CustomField;

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

my $Obj = new RT::CustomField($RT::SystemUser);

my($code,$msg) = $Obj->Create(Name=>“test”, Type=>‘Freeform’, MaxValues => 1);
print “(code,msg) = ($code),($msg)\n”;
my$id = $Obj->Id();
print “id=($id)\n”;On Fri, Nov 11, 2005 at 04:16:11PM -0600, Craig Stevenson wrote:

RT-ers:

I am attempting to write a script that will allow me to build the custom
fields for tickets in a particular queue. I am using the CLI rather
than the web interface. The table that hold this data is CUSTOMFIELDS.
This means I want to work with RT::CustomField.

I am running into trouble with a create. To my mind the following
should kick back a useable ID but it does not.
------------script--------------------------
#!/usr/local/rt/perl/bin/perl -w

use strict;

use lib “/usr/local/rt/lib”;
use RT::Interface::CLI qw(CleanEnv);
use RT::CustomField;

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

my$Obj = new RT::CustomField($RT::SystemUser);

my($code,$msg) = $Obj->Create(Name=>“test”);
print “(code,msg) = ($code),($msg)\n”;
my$id = $Obj->Id();
print “id=($id)\n”;
------------output--------------------------
(code,msg) = (0),()
id=()
------------done--------------------------
Any pointers here would be very appreciated. Thanks! Enjoy your weekend…

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


The rt-users Archives

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Buy your copy of our new book, RT Essentials, today!

Download a free sample chapter from http://rtbook.bestpractical.com

This user has left our organisation - please unsubscribe from this
distribution list