Hi Bernard,
Typically you dump the contents of data structures with a module like Data::Dumper.
So if you'd take the file bin/otrs.GetTicketThread.pl which is on your OTRS system, this utility prints out a ticket to the screen.
If you would open this file in a text editor, set DynamicFields to '1' and then add, at the end of the file, these two lines:
use Data::Dumper;
print Dumper (\%Ticket);
and then run bin/otrs.GetTicketThread.pl [TicketID] on the command line, it will present the contents of the TicketGet() call.
I created a dynamic field on a ticket called 'MyTicketField' and you see it returned, in my case even on the very top of the hash:
=====================================================================
TicketNumber: 2012061610000043
TicketID: 984
Created: 2012-06-16 20:37:27
Queue: Postmaster
State: open
Priority: 3 normal
Lock: unlock
---------------------------------------------------------------------
ArticleID: 6427
From: OTRS System <otrs@localhost>
To: my.customer@otrs.com,
Subject: [Ticket#2012061610000043] Test ticket subject
Created: 2012-06-16 20:37:27
SenderType: agent
Body:
Test ticket body
Your Ticket-Team
Michiel Beijen
--
Super Support - Waterford Business Park
5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA
Email: hot@example.com - Web: [1]http://www.example.com/
--
[1] http://www.example.com/
---------------------------------------------------------------------
$VAR1 = {
'DynamicField_MyTicketField' => 'My Dynamic Field Contents',
'Age' => 165,
'PriorityID' => 3,
'ServiceID' => '',
'DynamicField_TicketFreeText3' => undef,
'Type' => 'default',
'Responsible' => 'root@localhost',
'StateID' => 4,
'ResponsibleID' => 1,
'DynamicField_TicketFreeText1' => undef,
'ChangeBy' => 2,
'EscalationTime' => 0,
'DynamicField_TicketFreeTime6' => undef,
'OwnerID' => 2,
'Changed' => '2012-06-16 20:37:27',
'RealTillTimeNotUsed' => 0,
'GroupID' => 1,
'Owner' => 'michiel',
'CustomerID' => undef,
'DynamicField_TicketFreeKey3' => undef,
'TypeID' => 1,
'Created' => '2012-06-16 20:37:27',
'Priority' => '3 normal',
'UntilTime' => 0,
'EscalationUpdateTime' => 0,
'DynamicField_TicketFreeTime1' => undef,
'QueueID' => 1,
'Queue' => 'Postmaster',
'State' => 'open',
'Title' => 'Test ticket subject',
'CreateBy' => 2,
'TicketID' => 984,
'StateType' => 'open',
'DynamicField_TicketFreeText2' => undef,
'UnlockTimeout' => 1339871847,
'EscalationResponseTime' => 0,
'EscalationSolutionTime' => 0,
'DynamicField_TicketFreeKey1' => undef,
'LockID' => 1,
'TicketNumber' => '2012061610000043',
'ArchiveFlag' => 'n',
'CreateTimeUnix' => 1339871847,
'Lock' => 'unlock',
'SLAID' => '',
'CustomerUserID' => undef
};
Hope this helps!
--
Mike
Hi,
Le 15 juin 2012 à 15:58, Martin Gruner a écrit :Hi Bernard,
just use TicketGet(...., DynamicFields => 1); and you will get all fields on the result hash.
Regards, mg
In fact I have made a call with DynamicFields => 1but the problem is that I get the name of the field but not the valuesmall piece of code :my %Ticket = $Self->{TicketObject}->TicketGet(TicketID => $Param{TicketID},UserID => 1,DynamicFields => 1, # To get DynamicFields in Ticket map);return 1 if !%Ticket;while( my ($k,$v) = each(%Ticket) ) {$Self->{LogObject}->Log( Priority => 'info', Message => "key=$k value=$v" );}$Self->{LogObject}->Log( Priority => 'info', Message => "End of my own module" );gives :[Fri Jun 15 17:48:19 2012][Info][Kernel::System::Ticket::Event::EventModuleIsCompanyTicket::Run] key=CreateTimeUnix value=1339775299[Fri Jun 15 17:48:19 2012][Info][Kernel::System::Ticket::Event::EventModuleIsCompanyTicket::Run] key=SLAID value=[Fri Jun 15 17:48:19 2012][Info][Kernel::System::Ticket::Event::EventModuleIsCompanyTicket::Run] key=CustomerUserID value=bchambonascustomer[Fri Jun 15 17:48:19 2012][Info][Kernel::System::Ticket::Event::EventModuleIsCompanyTicket::Run] key=DynamicField_IsCompanyTicket value=[Fri Jun 15 17:48:19 2012][Info][Kernel::System::Ticket::Event::EventModuleIsCompanyTicket::Run] End of my own module
I also have other problem with eventsI can fire an event with 'TicketCreate' (as in my previous example)but I CAN'T fire anything when moving Ticket between queue. I have tried several EventName (see below), without result<ConfigItem Name="Ticket::EventModulePost###EventModuleIsCompanyTicket" Required="0" Valid="1"><Description Translatable="1">To set a ticket as private ...</Description><Group>Ticket</Group><SubGroup>Core::Ticket</SubGroup><Setting><Hash><Item Key="Module">Kernel::System::Ticket::Event::EventModuleIsCompanyTicket</Item><!-- Event fired with TicketCreate, but can't get Value from DynamicField --><!-- <Item Key="Event">TicketCreate</Item> --><!-- Can't fire an event on TicketQueueUpdate , an Event Name problem or something else ? --><Item Key="Event">TicketQueueUpdate|TicketMoveTicket|MoveTicket</Item><Item Key="new">open</Item></Hash></Setting></ConfigItem>however , with notification (sending email for ex) 'TicketQueueUpdate' seems to workhoping better for next week...Best regards---------------
Bernard CHAMBON
IN2P3 / CNRS
04 72 69 42 18
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs