Including latest transactions in RSS-Feed

Hi guys!

I’m looking for a possibility to include the latest transactions
(comments, correspondance) in the RSS feed of a saved search.
At the moment, only the content of the FIRST transaction is included into
the feed.

What I’m looking for is a possibility to have every transaction (of types
Create, Correspond, Comment, Resolve) for a ticket in the feed.
How could I achieve this?

BR,
Markus

Is anybody out there who could lead me into the right direction?
Maybe der is already a plugin handling this???

BR,
Markus

Hi guys!

I’ve managed, to play a little bit with the RSS-feed generation at
/html/Search/Elements/ResultsRSSView

But at the moment I’m stuck at fetching the latest transaction with type
"Correspond" or “Comment” from the database for displaying the right
content.
Is anybody out there who could help me with this?

My current code looks like:

while ( my $Ticket = $Tickets->Next()) {
my $transactions = RT::Transactions->new($session{CurrentUser});
$transactions->LimitToTicket($Ticket->id);

    # Limit to transactions with type "Comment"
    $transactions->Limit(
            FIELD => 'Type',
            VALUE => 'Comment'
    ); 

    my $content = $transactions->Last->Content;

I get the following error in the logs:
Can’t call method “Content” on an undefined value at
/opt/rt4-devel/local/html/Search/Elements/ResultsRSSView

I don’t know actually, why the variable $transactions has an undefined
value.

Greetings,
Markus

Hi,

$transactions isn’t undefined but $transactions is an empty collection
and thus $transactions->Last is undefined.
This happens on tickets that don’t have a Comment transaction.

Depending in the surrounding code a simple

return unless $transactions->Count;

before the ‘my $comment …’ would help here.

Also instead of

my $transactions = RT::Transactions->new($session{CurrentUser});
$transactions->LimitToTicket($Ticket->id);

you maybe better write

my $transactions = $Ticket->Transactions;

as this also takes merged tickets into account.

ChrisAm 27.08.2015 um 16:27 schrieb Markus.Wildbolz@eu.magna.com:

Hi guys!

I’ve managed, to play a little bit with the RSS-feed generation at
/html/Search/Elements/ResultsRSSView

But at the moment I’m stuck at fetching the latest transaction with type
"Correspond" or “Comment” from the database for displaying the right
content.
Is anybody out there who could help me with this?

My current code looks like:

while ( my $Ticket = $Tickets->Next()) {
my $transactions = RT::Transactions->new($session{CurrentUser});
$transactions->LimitToTicket($Ticket->id);

    # Limit to transactions with type "Comment"
    $transactions->Limit(
            FIELD => 'Type',
            VALUE => 'Comment'
    );        

    my $content = $transactions->Last->Content;

I get the following error in the logs:
Can’t call method “Content” on an undefined value at
/opt/rt4-devel/local/html/Search/Elements/ResultsRSSView

I don’t know actually, why the variable $transactions has an undefined
value.

Greetings,
Markus

Hi Christian!

Thanks for your input.
Now I managed to change the RSS content, so that it outputs the latest
transaction (Comment/Correspond) for each ticket in the search result.

Maybe someone updates this in the release version, because I think, that
this content is of a bigger interest than just the contents of the
initially created tickets. Patch file is attached…

Greetings,
Markus

P.S.: Danke nochmal für die Unterstützung - hat mir sehr geholfen!

ResultsRSSView.patch (1.89 KB)