Number of transactions on a ticket

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?

Thanks.
Kind regards.

Luke

Hi.

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 :slight_smile:

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

Kind regards.

Luke