RT 3.2.1 Custom field in $RT::DefaultSearchResultFormat

We have several queues, each with their own custom field named “area”.
How can I update the $RT::DefaultSearchResultFormat to display the
correct custom field for the correct queue?

CF.15.{area} works wonderfully. But only for queue id 15. I am trying
to do something like “CF.$QueueObj->id.{area}”. But I don’t think
$QueueObj is defined at that point. Is there any way to do this?

Jeremy Baumgartner
CAE UNIX Systems Staff

“Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.”

  • Brian W. Kernighan

If all of the queues have a custom field with the same name, is there
something preventing you from using a global custom field? Then, I
believe, you can use CF.0.{area}. I haven’t tried anything like this,
it is just something that would make sense to me.

Jeremy Baumgartner wrote:

I found a way to make it do what I was looking for. I’ll submit it to
rt-devel to see what they think.

This doesn’t allow sorting by custom field, but that’s not a major issue
for us.

The DefaultSearchResultFormat simply has ‘Area’ listed in it where I
want this to be.

–snip–
— Elements/TicketList.backup Mon Aug 2 13:00:43 2004
+++ Elements/TicketList Mon Aug 2 13:52:10 2004
@@ -131,6 +131,15 @@
}
}
$COLUMN_MAP = {

  • Area => {
  •   title => 'Area',
    
  •   value => sub {
    
  •           my $cf = RT::CustomField->new( $session{'CurrentUser'}
    

);

  •           $cf->LoadByNameAndQueue( Queue => $_[0]->QueueObj->id,
    

Name => ‘area’ );

  •           my $values = $_[0]->CustomFieldValues('".$cf->id."');
    
  •           return ( join( ', ', map { $_->Content } @{
    

$values->ItemsArrayRef } ))

  •   }
    
  • },
    QueueName => {
    attribute => ‘Queue’,
    title => ‘Queue’,
    –snip–On Mon, 2004-08-02 at 12:27, Jeremy Baumgartner wrote:

We have several queues, each with their own custom field named “area”.
How can I update the $RT::DefaultSearchResultFormat to display the
correct custom field for the correct queue?

CF.15.{area} works wonderfully. But only for queue id 15. I am trying
to do something like “CF.$QueueObj->id.{area}”. But I don’t think
$QueueObj is defined at that point. Is there any way to do this?
Jeremy Baumgartner
CAE UNIX Systems Staff

“Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.”

  • Brian W. Kernighan