Retrieving values in a db table from within scrips

Hello,

I am going to add a table to the rt schema to store escalation times for
our various queues. These times vary between queue, urgency (set using
custom field on case entry) and ticket type (set using a custom field on
case entry).

How can I retrieve these values in a scrip? Can I simply do the usual
stuff as I would in any perl script?

Thanks in advance,

Stewart
Stewart Tranter
Computing Services
Loughborough University

E: s.g.tranter@lboro.ac.uk
W: http://www.lboro.ac.uk/computing/
T: +44 (0) 1509 223719
F: +44 (0) 1509 223989

Are you sure it wouldn’t be better to use RT’s attributes?

-ToddOn Mon, Dec 12, 2005 at 11:39:30AM +0000, Stewart Tranter wrote:

Hello,

I am going to add a table to the rt schema to store escalation times for
our various queues. These times vary between queue, urgency (set using
custom field on case entry) and ticket type (set using a custom field on
case entry).

How can I retrieve these values in a scrip? Can I simply do the usual
stuff as I would in any perl script?

Thanks in advance,

Stewart

Stewart Tranter
Computing Services
Loughborough University

E: s.g.tranter@lboro.ac.uk
W: IT Services | Loughborough University
T: +44 (0) 1509 223719
F: +44 (0) 1509 223989


The rt-users Archives

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

Download a free sample chapter of RT Essentials from O’Reilly Media at
http://rtbook.bestpractical.com

WE’RE COMING TO YOUR TOWN SOON - RT Training in Amsterdam, Boston and
San Francisco - Find out more at
http://bestpractical.com/services/training.html

Todd Chapman wrote:

Are you sure it wouldn’t be better to use RT’s attributes?

-Todd

No, I’m not sure it wouldn’t be better to use RT’s attributes. What are
they?

Stewart
Stewart Tranter
Computing Services
Loughborough University

E: s.g.tranter@lboro.ac.uk
W: IT Services | Loughborough University
T: +44 (0) 1509 223719
F: +44 (0) 1509 223989

Todd Chapman wrote:

Are you sure it wouldn’t be better to use RT’s attributes?

-Todd

No, I’m not sure it wouldn’t be better to use RT’s attributes. What are
they?

An easy way to store and retrieve misc values associated with
any object in RT.

perldoc /opt/rt3/lib/RT/Attributes_Overlay.pm
perldoc /opt/rt3/lib/RT/Attribute_Overlay.pm

Todd Chapman wrote:

An easy way to store and retrieve misc values associated with
any object in RT.

perldoc /opt/rt3/lib/RT/Attributes_Overlay.pm
perldoc /opt/rt3/lib/RT/Attribute_Overlay.pm

Hmm, this may be what we’re looking for. Can you shed some more light
on their usage, i.e. how I call the various methods to upload our data,
via a Perl script or the RT command line?

Also, are there pre-defined values needed for ContentType and ObjectType?

How would I call these things within a scrip?

TIA,

Stewart
Stewart Tranter
Computing Services
Loughborough University

E: s.g.tranter@lboro.ac.uk
W: IT Services | Loughborough University
T: +44 (0) 1509 223719
F: +44 (0) 1509 223989

Todd Chapman wrote:

An easy way to store and retrieve misc values associated with
any object in RT.

perldoc /opt/rt3/lib/RT/Attributes_Overlay.pm
perldoc /opt/rt3/lib/RT/Attribute_Overlay.pm

Hmm, this may be what we’re looking for. Can you shed some more light
on their usage, i.e. how I call the various methods to upload our data,
via a Perl script or the RT command line?

Also, are there pre-defined values needed for ContentType and ObjectType?

How would I call these things within a scrip?

See also these methods:

RT::Record::Attributes
RT::Record::AddAttribute
RT::Record::SetAttribute
RT::Record::DeleteAttribute
RT::Record::FirstAttribute

Because each RT::Queue ISA RT::Record, these methods can
be used on a Queue to store and fetch attributes with any
name you like to give them.

-Todd

Todd Chapman wrote:

See also these methods:

RT::Record::Attributes
RT::Record::AddAttribute
RT::Record::SetAttribute
RT::Record::DeleteAttribute
RT::Record::FirstAttribute

Because each RT::Queue ISA RT::Record, these methods can
be used on a Queue to store and fetch attributes with any
name you like to give them.

Sorry, now I’m even more confused!!! :frowning:

I still don’t understand how to create the attribute and what values I
must populate, e.g.

Content: (obviously what I want to store)
ContentType: Does this need to be a specific value?
ObjectType: Does this need to be a specific value?

I’m also still confused how I will even create these attribute objects.

Sorry for being so dumb!

Stewart