Free Text Field default not working

Moderator: crythias

Locked
IcarusNM
Znuny newbie
Posts: 21
Joined: 11 Jan 2012, 04:13
Znuny Version: 3.0.9
Real Name: Paul Caskey
Company: Interface Systems

Free Text Field default not working

Post by IcarusNM »

I have set up the FreeText1 field to be called "Visibility" with the same kind of 1-5 scale as Priority and elsewhere. I did this all in SysConfig. Here is how it ends up in ZZZAuto.pm.

Code: Select all

$Self->{'TicketFreeText1::DefaultSelection'} =  '3 normal';
$Self->{'TicketFreeText1'} =  {
  ''  => '-',
  '1' => '1 very low',
  '2' => '2 low',
  '3' => '3 normal',
  '4' => '4 high',
  '5' => '5 very high'
};
$Self->{'TicketFreeKey1'} =  {
  'Visibility' => 'Visibility'
};
I then included this field 1 as either optional (1) or required (2) in a couple of views.

The DefaultSelection does not work. I have tried setting it to the Key, and the Value, and neither works. Above you see it is set to the Value ('3 normal'). No matter the view where I activate this field, the HTML page always ends up with no default selection, so it reverts to '-' or whatever I have first in the list.

This is OTRS 3.0.9 with ITSM. What am I doing wrong? I don't see mention of this bug fixed in the 3.0.10 or 3.0.11 release notes.
yuri0001
Znuny superhero
Posts: 630
Joined: 17 Mar 2011, 14:40
Znuny Version: 5.0.6
Real Name: Yuri Kolesnikov
Location: Russia

Re: Free Text Field default not working

Post by yuri0001 »

Try to see SysConfig in Ticket -> Core::TicketFreeTextDefault
Best regards Yuri Kolesnikov
OTRS 5.0.14, ITSM 5.0.14
SUSE 13.2, MariaDB 10.0.22(productive)
OTRS 5.0.14, ITSM 5.0.14(test)
IcarusNM
Znuny newbie
Posts: 21
Joined: 11 Jan 2012, 04:13
Znuny Version: 3.0.9
Real Name: Paul Caskey
Company: Interface Systems

Re: Free Text Field default not working

Post by IcarusNM »

yuri0001 wrote:Try to see SysConfig in Ticket -> Core::TicketFreeTextDefault
I saw that. Now looking harder. It looks like a total quagmire. I've never seen something so simple made so complicated. OTRS developers: Get some help. An intervention is in order. ;)

P.S. By the way:
SysConfig -> Core::TicketFreeTextDefault wrote:Please check the developer manual (http://doc.otrs.org/), chapter "Ticket Event Module".
There is no "Ticket Event Module" there in the manual. The only occurrence of the word "event" on the page http://doc.otrs.org/ is "5.3. Events for Auto answers" which I don't think is it. I found http://doc.otrs.org/3.0/en/html/Ticket. ... extDefault which sure enough is full of the term "EventModule" and may qualify as the world's longest web page. Seriously, guys. Intervention.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Free Text Field default not working

Post by crythias »

Did you also set the default TicketFreeKey1?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
IcarusNM
Znuny newbie
Posts: 21
Joined: 11 Jan 2012, 04:13
Znuny Version: 3.0.9
Real Name: Paul Caskey
Company: Interface Systems

Re: Free Text Field default not working

Post by IcarusNM »

crythias wrote:Did you also set the default TicketFreeKey1?
Yes, and I finally figured out that should be set to 'Visibility' if anything, and isn't needed since 'Visibility' is the only option.

The Core::TicketFreeTextDefault hack appears to work. This TicketCreate event seems to happen very early in the game, so by the time anyone gets to one of the ticket property views (like Owner or Priority) this new field will already be set. Cool. Here's the resulting magic code.

Code: Select all

$Self->{'Ticket::TicketFreeFieldDefault'}->{'Element1'} =  {
  'Counter' => '1',
  'Event' => 'TicketCreate',
  'Key' => '3',
  'Value' => '3 normal'
};
$Self->{'Ticket::EventModulePost'}->{'TicketFreeFieldDefault'} =  {
  'Module' => 'Kernel::System::Ticket::Event::TicketFreeFieldDefault',
  'Transaction' => '1'
};
In other words, the TicketFreeText1::DefaultSelection option is completely broken, and should be ignored. Instead one must use the even more arcane Core::TicketFreeTextDefault section and tie their default selection to the TicketCreate event. Good to know. Obviously the DefaultSelection option is way too obvious and intuitive. :roll:
Locked