dynamic field value default for Date/Time

Moderator: crythias

Locked
robotcop
Znuny newbie
Posts: 6
Joined: 10 Apr 2015, 12:49
Znuny Version: OTRS4

dynamic field value default for Date/Time

Post by robotcop »

Hello crythias,

I have a dynamic field with type "Date/Time". I want to set its default value to current datetime while creating a ticket by fetching email from support emailbox. I tried to set the value to "now()" in Ticket::TicketDynamicFieldDefault###Element1 under SysConfig-> Ticket -> Core::TicketDynamicFieldDefault. However, I got the error message "OTRS-CGI-50: Can not set value now() for dynamic field IncidentDateTime!" . I checked table dynamic_field_value, other text's dynamic fields were created successfully, but not the field for datetime.

Ticket::TicketDynamicFieldDefault###Element1 ->
Event = TicketCreate
Name = IncidentDateTime
Value = now()

Do you know how to setup the dynamic field value default to current time?
OTRS 4 on Linux with MySQL database.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: dynamic field value default for Date/Time

Post by RStraub »

I think one of the possible syntax to enter a default value, is the difference to current time in seconds.

Did you try to set the default value to "1" ? (0 wouldn't work, as that unchecks the field)
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
robotcop
Znuny newbie
Posts: 6
Joined: 10 Apr 2015, 12:49
Znuny Version: OTRS4

Re: dynamic field value default for Date/Time

Post by robotcop »

Hi RStraub,

Thanks for your suggestion. I tried both "0" & "1", and it still failed to create the related dynamic_field_value record for datetime. The error is similiar as before "OTRS-CGI-50 Can not set value 1 for dynamic field IncidentDateTime".
:(
OTRS 4 on Linux with MySQL database.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: dynamic field value default for Date/Time

Post by RStraub »

I just tried to recreate the problem and it appears for me as well. The weird part is, that the apache log shows no further information where the module fails.

As a "workaround" I would suggest to create a generic agent, which listens to "TicketCreate" (and whatever else you wish) and as Action, sets a default value to your dynamic field.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
robotcop
Znuny newbie
Posts: 6
Joined: 10 Apr 2015, 12:49
Znuny Version: OTRS4

Re: dynamic field value default for Date/Time

Post by robotcop »

The default value of Generic Agent is a fixed value always although system is able to create a record in table dynamic_field_value. My requirement is to set the default dateitme value to now(), everytime the value shall change with the ticket creation.

Thanks for your workaround. :)
OTRS 4 on Linux with MySQL database.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: dynamic field value default for Date/Time

Post by crythias »

robotcop wrote: I want to set its default value to current datetime while creating a ticket by fetching email from support emailbox
You mean that you want to duplicate the value of the ticket's create time in another field? I suppose you could try that, but then again, you have that information as the create time of the ticket.
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
robotcop
Znuny newbie
Posts: 6
Joined: 10 Apr 2015, 12:49
Znuny Version: OTRS4

Re: dynamic field value default for Date/Time

Post by robotcop »

Hi crythias,

Cox the ticket creation datetime cannot be changed after ticket creation. May I know how can I set the default value for dynamic field as the creation time?
OTRS 4 on Linux with MySQL database.
Locked