I have created a new template that is attached to a script that emails the AdminCC when a ticket is moved into a specific Queue.
I have included this in my template: {$Transaction->Content()}
All of the other data (ticket number, link to the ticket, etc) all populate in the email correctly but where the {$Transaction->Content()} is just returns:
This transaction appears to have no content.
I am trying to figure out how to get the content to be included.
Subject: New Ticket Created in the ({$Ticket->QueueObj->Name}) Queue
You are receiving this email because you are an AdminCc of the {$Ticket->QueueObj->Name} queue.
Click here to take it: {RT->Config->Get('WebURL')}Ticket/Display.html?Action=Take&id={$Ticket->id}
View Ticket: {RT->Config->Get('WebURL')}Ticket/Display.html?id={$Ticket->id}
Queue: {$Ticket->QueueObj->Name}
Requestors: {$Ticket->RequestorAddresses}
Owner: {$Ticket->OwnerObj->Name}
Status: {$Ticket->Status}
Subject: {$Transaction->Subject || $Ticket->Subject || '(No subject given)'}
=========================================================
{$Transaction->Content()}
Thank You, it is indeed on a Queue change. Is there anyway I can get this data, it would be nice to include in the email that goes out. And is there some specific reason why it does not have access to this data on a queue change? I see it in the database.
Are you trying to show the most recent comment/correspondence (the two transaction types that will usually have content), or the first initial transaction that opened the ticket, or all the comments/correspondence attached to this ticket?
Thank you for the tip about ‘ticket transactions first content’. That is a big improvement for my environment.
How would I include the entire ticket history instead of just the first content?
Better yet, how can I explore what other options exist at {Ticket->Transactions->}? I did some searching through the documentation and totally failed to find a reference to {Ticket->Transactions->First}
The First comes from the Perl module DBIx::SearchBuilder, which is what RT’s database access is built on top of. The RT::Transactions module inherits from this, and adds some methods of its own. The whole of RT makes heavy use of Perl’s object oriented module system with inheritance so you sometimes need to track down what other modules an RT module inherits from (my one major complaint about the RT docs is that they don’t make this very clear, and you often need to look at the library files to see the use lines they have in them).
You’ll find that many of the RT Perl modules that find “collections” of things such as transactions, users, tickets, etc from the database then let you use methods like First, Last, Next, etc from DBIx::SearchBuilder. You can use these to build while loops in Perl like this:
my $txns = $TicketObj->Transactions;
while(my $thisTxn = $txns->Next) {
# Do something exciting with the transaction in $thisTxn
}
In the case of RT::Transactions the collection is a set of records, each an instance of the RT::Transaction module. For RT::Tickets it would be a collection of RT::Ticket records, for RT::Users a collection of RT::User records, etc.
To see the whole of a ticket’s history in a template you’ll have to use a Perl type template and do a loop over all the transactions attached to the ticket (as above), picking out the content from each transaction that has some. You might want content to only be from the transaction type you want - you might just want to see correspondence but no comments for example.