On 13 Jul 2012, at 01:01, Richard McMahon wrote:

> OK, that gets me the queue list.
> 
> Is there an API way to get the full list of valid status values

That's part of the configuration; it's not an API as such.  That information is 
all configurable by you in the %Lifecycle configuration (look in RT_Config.pm).

See the documentation for the RT::Lifecycle module:

my $lifecycle = RT::Lifecycle->Load('default');
my @statuses = $lifecycle->Valid;

probably gets you what you want.  Most of the perl classes that the 
BestPractical guys expect us to use in scripts have reasonable pod 
documentation, although often you have to remember to also consult the 
superclass documentation as well, since sometimes the documentation is at that 
level, in things like RT::Record and RT::SearchBuilder.

> and also
> the list of names of ticket owners.

Well, you can always construct that from any list of tickets that you've 
previously obtained.  The method is similar to the one mentioned before for 
iterating over queues; instead, you iterate over the tickets and fetch the name 
of the owner from each one.  Note that this is likely to be quite slow if there 
are a lot of tickets.

You could, of course query the database directly, with something like:

select distinct(u.Name) from Users u, Tickets t where t.Owner = u.id;

but querying the database directly is not generally considered a smart thing to 
do, although I doubt this part of the schema is going to change any time soon.

> I have looked that the code
> that Ruslan mentions but I am able see how to get at the owner
> list and list of valid status values.

I find that most of the RT code base itself is usually fairly clear (with the 
exceptions of some of the hairier web interface corners), and when I want to 
find out how to do something in the RT API I just search the main RT code for 
places where the same thing is being done, and copy it!

Regards,

Tim

--
 The Wellcome Trust Sanger Institute is operated by Genome Research
 Limited, a charity registered in England with number 1021457 and a
 company registered in England with number 2742969, whose registered
 office is 215 Euston Road, London, NW1 2BE.

Reply via email to