%# Never call a man a fool; borrow from him. <& List, List => $List, Queue => $QueueObj->Id, ListCount => $ListCount &> <%INIT> my $List = []; my $ListCount = {}; my $Tickets = RT::Tickets->new( $session{'CurrentUser'} ); $Tickets->LimitQueue( VALUE => $QueueObj->Id ); $Tickets->LimitType( VALUE => 'release' ); while (my $Item = $Tickets->Next) { my (%url, %description, %documents); my $transactions = $Item->Transactions; while (my $trans = $transactions->Next) { my $attachments = $trans->Attachments; my $subject = $trans->Subject; while (my $attach = $attachments->Next) { next unless ($attach->Filename); # most recent at the top # unshift (@{$documents{$attach->Filename}}, $attach); $documents{$attach->Filename} = $attach; $description{$attach->Id} = $subject; $url{$attach->Id} = join( '/', "/Foundry/Project/Download/Attachment", $trans->Id, $attach->Id, $attach->Filename ); } } my $count = 0; foreach my $key (keys %documents) { my $Id = $documents{$key}->Id; push @$List, { Id => $Id, ReleaseObj => $Item, Attachment => $documents{$key}, URL => $url{$Id}, Description => $description{$Id}, }; $count++; } $ListCount->{$Item->Id} = $count; } <%ARGS> $QueueObj