RT Query - how to display last comment

To List,

Does anyone know how to get the last comment on a ticket to display in a
Query? I can get it in a template, but it doesn’t seem available in a Query.

Kenn
LBNL

Hi,

If you mean search results and thier format strings then there is no
such column map, but it’s possible to add. Look at
share/html/Elements/RT__Ticket/ColumnMap.On Sat, Dec 11, 2010 at 1:44 AM, Kenneth Crocker kfcrocker@lbl.gov wrote:

To List,

Does anyone know how to get the last comment on a ticket to display in a
Query? I can get it in a template, but it doesn’t seem available in a Query.

Kenn
LBNL

Best regards, Ruslan.

Ruslan,

Would this be the correct code:

Comment => {
    title     => 'Comment', # last comment
    attribute => 'Comment',
    value     => sub { return $_[0]->TransObj->Id( $_[0]->id

)->Field(‘Type’)->Value(‘Comment’) }
},

Thanks.

Kenn
LBNLOn Sun, Dec 12, 2010 at 6:13 AM, Ruslan Zakirov ruz@bestpractical.comwrote:

Hi,

If you mean search results and thier format strings then there is no
such column map, but it’s possible to add. Look at
share/html/Elements/RT__Ticket/ColumnMap.

On Sat, Dec 11, 2010 at 1:44 AM, Kenneth Crocker kfcrocker@lbl.gov wrote:

To List,

Does anyone know how to get the last comment on a ticket to display in a
Query? I can get it in a template, but it doesn’t seem available in a
Query.

Kenn
LBNL


Best regards, Ruslan.

Hi,

It’s absolutly incorrect. It should look close to the following code:

value => sub {

my $txns = $_[0]->Transactions;
$txns->Limit(FIELD => ‘Type’, VALUE => ‘Correspond’ );
$txns->OrderBy(
{ FIELD => ‘Created’, ORDER => ‘DESC’ },
{ FIELD => ‘id’, ORDER => ‘DESC’ },
);
my $txn = $txns->First;
return ‘No replies on the ticket’ unless $txn;

return $txn->Content;
}

Something along above lines, never tested.On Mon, Dec 13, 2010 at 10:56 PM, Kenneth Crocker kfcrocker@lbl.gov wrote:

Ruslan,

Would this be the correct code:

Comment => {
    title     => 'Comment', # last comment
    attribute => 'Comment',
    value     => sub { return $_[0]->TransObj->Id( $_[0]->id

)->Field(‘Type’)->Value(‘Comment’) }
},

Thanks.

Kenn
LBNL

On Sun, Dec 12, 2010 at 6:13 AM, Ruslan Zakirov ruz@bestpractical.com wrote:

Hi,

If you mean search results and thier format strings then there is no
such column map, but it’s possible to add. Look at
share/html/Elements/RT__Ticket/ColumnMap.

On Sat, Dec 11, 2010 at 1:44 AM, Kenneth Crocker kfcrocker@lbl.gov wrote:

To List,

Does anyone know how to get the last comment on a ticket to display in a
Query? I can get it in a template, but it doesn’t seem available in a
Query.

Kenn
LBNL


Best regards, Ruslan.

Best regards, Ruslan.