Modifying Results.rdf

Hi All,

In Search/Results.rdf, I’d like to modify the line below marked with >>>>>:

while ( my $Ticket = $Tickets->Next()) {

    my $creator_str = $m->scomp('/Elements/ShowUser', User =>

$Ticket->CreatorObj);

    $creator_str =~ s/[\r\n]//g;

    $rss->add_item(

      title       =>  $Ticket->Subject || loc('No Subject'),

      link        =>

RT->Config->Get(‘WebURL’).“Ticket/Display.html?id=”.$Ticket->id,

description => $Ticket->Transactions->First->Content,
      dc          => { creator => $creator_str,

                       date => $Ticket->CreatedObj->RFC2822,

                     },

      guid        => $Ticket->Queue . '_' . $Ticket->id,

    );

}

What I’m hoping to see in the RSS is either the last Correspondence or
Comment in the ticket, or the Create statement if it is new. I can change
the command to $Ticket->Transactions->Last->Content but it will simply print
out “This transaction appears to have no content” if the last action was
something like an ownership change.

I believe what I ultimately want to do is show the Content for the last
Transaction where the Type is either Correspond, Comment or Create. Any
documentation pointers or code snippets that will help get me there are
appreciated.

Thanks!

–drew

Hi All,

What I’m hoping to see in the RSS is either the last Correspondence or
Comment in the ticket, or the Create statement if it is new. I can change
the command to $Ticket->Transactions->Last->Content but it will simply print
out “This transaction appears to have no content” if the last action was
something like an ownership change.

create a new method in local/lib/RT/Ticket_Local.pm with something like this:

sub LastMessage {
my $self = shift;

my $Transactions = $self->Transactions;
$Transactions->OrderBy(FIELD => 'Created', ORDER => 'DESC');
while ( my $Transaction = $Transactions->Next ) {
    if ( $Transaction->Type =~ /^(Correspond|Comment|Create)$/ && $Transaction->Content ) {
        return ($Transaction->Content);
    }
}
return (undef);

}

then in Results.rdf, use $Ticket->LastMessage.