Creating a dynamic field (dropdown) programmatically (MySQL)

Moderator: crythias

Post Reply
vincentb
Znuny newbie
Posts: 12
Joined: 30 Jan 2021, 07:51
Znuny Version: 6 community
Real Name: Vincent B.

Creating a dynamic field (dropdown) programmatically (MySQL)

Post by vincentb »

Hello,

I plan to create a dynamic field of type "Dropdown", but as it will have a lot of keys/values (200), and as I'll create the same field on several servers (at least test then production), I do not want to enter things manually using the OTRS "AdminDynamicFieldDropdown" form. I want to do that with a script.

I will take example on an existing dropdown field.
I think I will just create manually an "empty" dynamic field (i.e. without the keys/values) using the OTRS interface, and then I will use a script to SET the "PossibleValues" part of the "config" field of the dynamic_field table of the otrs database.

My question:
Are there things to know, like some precautions or perhaps dependencies elsewhere in other otrs data points I should be aware of?

Thanks
alexus
Znuny wizard
Posts: 380
Joined: 20 Sep 2010, 16:54
Znuny Version: OTRS 6 CE
Real Name: Alexey Yusov
Company: Radiant System Group s.r.o
Location: Prague
Contact:

Re: Creating a dynamic field (dropdown) programmatically (MySQL)

Post by alexus »

Alexey Yusov

Production: OTRS CE ITSM 6.0.28 on CentOS 7 + Apache 2.4 + MariaDB 10.4.13 + Radiant Customer Portal

Radiant System OTRS Intergrator
RS4OTRS marketplace
Stay tuned on our Facebook
((OTRS)) Community Edition - what next?
vincentb
Znuny newbie
Posts: 12
Joined: 30 Jan 2021, 07:51
Znuny Version: 6 community
Real Name: Vincent B.

Re: Creating a dynamic field (dropdown) programmatically (MySQL)

Post by vincentb »

Thanks Alexus, but the ImportExportDynamicFields you mention does not answer to my question and to my needs.
(As far as I know that would just allow me to copy a dynamic field from a server to another one, but would provide no help for creating the dynamic field and its numerous keys/values.)
schulmann
Znuny wizard
Posts: 470
Joined: 20 Nov 2011, 16:08
Znuny Version: 6.5.4
Real Name: Schulmann

Re: Creating a dynamic field (dropdown) programmatically (MySQL)

Post by schulmann »

vincentb wrote: 30 Nov 2021, 18:38 I want to do that with a script.
Hello,

how about using https://doc.znuny.org/doc/api/otrs/6.0/Perl/index.html?

CD
Znuny6/Debian/ESXi
vincentb
Znuny newbie
Posts: 12
Joined: 30 Jan 2021, 07:51
Znuny Version: 6 community
Real Name: Vincent B.

Re: Creating a dynamic field (dropdown) programmatically (MySQL)

Post by vincentb »

Hi schulmann, thanks for the suggestion (using Perl OTRS libray), I admit it makes sense, but I do not want to learn all the OTRS and Perl stuff! (moreover I do not program using Perl)
I'm looking for a simple/quick solution, i.e. just a basic use of SQL for creating and/or updating some appropriate field with some appropriate value.
alexus
Znuny wizard
Posts: 380
Joined: 20 Sep 2010, 16:54
Znuny Version: OTRS 6 CE
Real Name: Alexey Yusov
Company: Radiant System Group s.r.o
Location: Prague
Contact:

Re: Creating a dynamic field (dropdown) programmatically (MySQL)

Post by alexus »

vincentb wrote: 30 Nov 2021, 19:02 I'm looking for a simple/quick solution, i.e. just a basic use of SQL for creating and/or updating some appropriate field with some appropriate value.
Check "config" column in dynamic_field table
Alexey Yusov

Production: OTRS CE ITSM 6.0.28 on CentOS 7 + Apache 2.4 + MariaDB 10.4.13 + Radiant Customer Portal

Radiant System OTRS Intergrator
RS4OTRS marketplace
Stay tuned on our Facebook
((OTRS)) Community Edition - what next?
Post Reply