[rt-users] number of transactions on a ticket

Luke Vanderfluit lvanderf at internode.com.au
Thu Dec 15 19:28:04 EST 2005


Luke Vanderfluit wrote:

> Hi.
> I'd like to find out how many transactions a ticket has.
> I can do this by querying the rt database with SQL using the following 
> query:
> select count(*) from Transactions where ObjectId=$id
> However, I'd like to do it through the API.
> Is there a simpler way to do this? eg. is there a variable that 
> already has the number of transactions in it?
OK. I've found a way :-)

%            $ticket = new RT::Ticket($RT::SystemUser);
%            $ticket->Load($id);
%            $transactions = $ticket->Transactions;
%            $numtrans = $transactions->count;

Kind regards.


More information about the rt-users mailing list