Query Questions

I have been asked to see if I can get RT to show the Ticket Content, using the basic Query Builder tool. In the actual query results window, I need to show the initial part of the request.

I know I can do this via an outside Perl script, or using the Rt command line, but I am trying to do it within the actual RT web interface.

From what I can tell the RT Query tool, queries the Ticket Table, and what I am after is in the Attachment table.

I am trying to use the advanced query tool to both query and display the first element of the content.

Is this possible, or do I have to do it via a Scrip? Most of the Scrips I have seen relate to an action, and some Email event.

My other option is to create another Custom Field and then write a scrip to populate that field with the content data.

Bryon

I have been asked to see if I can get RT to show the Ticket Content, using the basic Query Builder tool. In the actual query results window, I need to show the initial part of the request.

I know I can do this via an outside Perl script, or using the Rt command line, but I am trying to do it within the actual RT web interface.

From what I can tell the RT Query tool, queries the Ticket Table, and what I am after is in the Attachment table.

I am trying to use the advanced query tool to both query and display the first element of the content.

Is this possible, or do I have to do it via a Scrip? Most of the Scrips I have seen relate to an action, and some Email event.

My other option is to create another Custom Field and then write a scrip to populate that field with the content data.

Bryon

Bryon,

To do what you want you will have to write some perl code.

html/Elements/RT__Ticket/ColumnMap defines translations from
columns to callbacks that are run when display search results.

You can augment this mapping with a callback called ColumnMap.

So you need to:

  1. Create a callback.
  2. Insert the correct code into the callback. (grok RT API?)
  3. Get your new column name to show up in the query builder.

The last step involves a local copy of html/Search/Elements/BuildFormatString.

Is that enought to get you started?

-Todd

I think so, inside html/Elements/RT__Ticket/ColumnMap I see references to things like
LastUpdated => {
attribute => ‘LastUpdated’,
title => ‘Last Updated’,
value => sub { return $_[0]->LastUpdatedObj->AsString }
},

So I need to figure out how to reference what I need and insert something like
Content=> {
attribute => ‘Content’,
title => 'Content,
value => sub { return $_[0]->Appropriate_stuff_here>AsString }
},

Or whatever the RT API indicates.

I am a mild PERL programmer, but it looks like I will have to dig in.

It’s a starting place.

If anyone out there already did this,I would love it if you shared your code. In the mean time, I will dig in.

I think so, inside html/Elements/RT__Ticket/ColumnMap I see references to things like
LastUpdated => {
attribute => ‘LastUpdated’,
title => ‘Last Updated’,
value => sub { return $_[0]->LastUpdatedObj->AsString }
},

So I need to figure out how to reference what I need and insert something like
Content=> {
attribute => ‘Content’,
title => 'Content,
value => sub { return $_[0]->Appropriate_stuff_here>AsString }
},

Or whatever the RT API indicates.

I am a mild PERL programmer, but it looks like I will have to dig in.

It’s a starting place.

If anyone out there already did this,I would love it if you shared your code. In the mean time, I will dig in.

Something like:

$_[0]->Transactions->First->Content;