Dynamic Fields

English! place to talk about OTRS development, programming and coding

Moderator: tto

Post Reply
Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Dynamic Fields

Post by Ytigiev » 28 Mar 2019, 13:10

Hello,

Please, advise a public resource which describes how to create a Dynamic Field DropDown which works with an external database (Postgre).
I want to create cascades dropdowns for allowing users to select Country and related City. Data for fields should load from an external db.

Regards,
Yuriy

fcasal
OTRS superhero
Posts: 279
Joined: 21 Apr 2014, 16:14
OTRS Version?: 6.0.18

Re: Dynamic Fields

Post by fcasal » 28 Mar 2019, 13:46

You can check the webs with addons than add features to otrs.

Greetings.

Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Re: Dynamic Fields

Post by Ytigiev » 28 Mar 2019, 14:45

Can you provide an example?

jojo
Moderator
Posts: 14522
Joined: 26 Jan 2007, 14:50
OTRS Version?: Git Master
Contact:

Re: Dynamic Fields

Post by jojo » 28 Mar 2019, 23:23

check https://otrs.com

DynamicFieldDatabase is a FeatureAddOn
"Production": OTRS™ 6, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com :: Share your ideas

root
Moderator
Posts: 1576
Joined: 18 Dec 2007, 12:23
OTRS Version?: 4/5/6
Real Name: Roy Kaldung
Company: Znuny Inc.
Contact:

Re: Dynamic Fields

Post by root » 29 Mar 2019, 11:09

Hi,

There is a addon free of charge: https://opar.perl-services.de/dist/Dyna ... teDB-6.0.3

And also oje with same functionality and some more feature from https://www.znuny.com

- Roy
OTRS 4/5/6 CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

You need professional services? Check out https://www.znuny.com/

Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Re: Dynamic Fields

Post by Ytigiev » 29 Mar 2019, 11:25

Hello,

Before have written on the forum I have tested this free addon. It didn't work properly. It didn't appear in any configurations menu. Maybe I did something incorrectly. The second problem was that OTRS warning about using a not verified module. I also tried to disable the notification, but without result.

Now I'm trying to implement the following solution (viewtopic.php?f=60&t=17033)
CGI - works correctly. What I can't understand, where I should put the code below. I have created my process, and the process doesn't have its own HTML page file where I can modify something.

Could someone help me?

<select id="myselect" name="DynamicField_fieldName">
</select>
<script type="text/javascript">
$.get('extdata.pl', function(data) {
$('#myselect').append(data);
});
</script>

User avatar
crythias
Moderator
Posts: 10080
Joined: 04 May 2010, 18:38
OTRS Version?: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Dynamic Fields

Post by crythias » 11 Apr 2019, 16:25

That would be in the template. Maybe.
OTRS 5.0.x (private/testing/public) on Linux with MySQL database. Also on github.
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

Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Re: Dynamic Fields

Post by Ytigiev » 12 Apr 2019, 08:27

I installed DynamicFieldRemoteDB package (https://opar.perl-services.de/dist/DynamicFieldRemoteDB)
It works correctly.

Now I'm thinking about how to implement the nested menu.
Can experts give me advice about how it possible to organize based on the DynamicFieldRemoteDB?

root
Moderator
Posts: 1576
Joined: 18 Dec 2007, 12:23
OTRS Version?: 4/5/6
Real Name: Roy Kaldung
Company: Znuny Inc.
Contact:

Re: Dynamic Fields

Post by root » 12 Apr 2019, 12:03

Hi,

My colleagues implemented as with an ACL module. Maybe this works for you.

- Roy
OTRS 4/5/6 CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

You need professional services? Check out https://www.znuny.com/

Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Re: Dynamic Fields

Post by Ytigiev » 12 Apr 2019, 12:55

Can you share the ACL configuration?
And did your college used DynamicFieldRemoteDB? I'm not sure, but I think DynamicFieldRemoteDB doesn't support the ACL.

root
Moderator
Posts: 1576
Joined: 18 Dec 2007, 12:23
OTRS Version?: 4/5/6
Real Name: Roy Kaldung
Company: Znuny Inc.
Contact:

Re: Dynamic Fields

Post by root » 15 Apr 2019, 09:39

Hi,

I'm sorry sharing the code is not an option, it's a commercial module. But ACL module are the typical use case for this. Grab the value for field 1 and return all possibilities for field 2.
We use this without DynamicFieldRemoteDB, we create the relations from a CSV file.

- Roy
OTRS 4/5/6 CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

You need professional services? Check out https://www.znuny.com/

Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Re: Dynamic Fields

Post by Ytigiev » 15 Apr 2019, 11:31

Did you create ACL rule for each parent record?
How do you load data into a dropdown from csv file?

root
Moderator
Posts: 1576
Joined: 18 Dec 2007, 12:23
OTRS Version?: 4/5/6
Real Name: Roy Kaldung
Company: Znuny Inc.
Contact:

Re: Dynamic Fields

Post by root » 15 Apr 2019, 11:36

Hi,

Here's an example for an non-GUI ACL: https://github.com/OTRS/otrs/blob/rel-6 ... dChilds.pm

You can use the API (https://doc.otrs.com/doc/api/otrs/6.0/P ... nd.pm.html) to add values parsed from anywhere to a Dynamic Field.

- Roy
OTRS 4/5/6 CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

You need professional services? Check out https://www.znuny.com/

Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Re: Dynamic Fields

Post by Ytigiev » 15 Apr 2019, 11:50

One question

A parent DropDown has two fields: key and value,
A child DropDown should have three fields: key, value and parent key for filtering.
How to store the third field in the child DropDown? In the Value field and use a separator?

root
Moderator
Posts: 1576
Joined: 18 Dec 2007, 12:23
OTRS Version?: 4/5/6
Real Name: Roy Kaldung
Company: Znuny Inc.
Contact:

Re: Dynamic Fields

Post by root » 15 Apr 2019, 12:17

Hi,

Except for a small amount of use cases usually I have keep keys and values in sync.

- Roy
OTRS 4/5/6 CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

You need professional services? Check out https://www.znuny.com/

Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Re: Dynamic Fields

Post by Ytigiev » 15 Apr 2019, 12:33

I don't understand what you mean (I have keep keys and values in sync).
My question was about store parent_id in the second dropdown for filtering

Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Re: Dynamic Fields

Post by Ytigiev » 15 Apr 2019, 12:39

How to access to the key of DynamicFields_df in the ACL?

root
Moderator
Posts: 1576
Joined: 18 Dec 2007, 12:23
OTRS Version?: 4/5/6
Real Name: Roy Kaldung
Company: Znuny Inc.
Contact:

Re: Dynamic Fields

Post by root » 15 Apr 2019, 12:40

Usually I have the same string in key and in value.

- Roy
OTRS 4/5/6 CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

You need professional services? Check out https://www.znuny.com/

Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Re: Dynamic Fields

Post by Ytigiev » 15 Apr 2019, 15:33

root wrote:
15 Apr 2019, 11:36

Here's an example for an non-GUI ACL: https://github.com/OTRS/otrs/blob/rel-6 ... dChilds.pm
I can use the example and write my own code. Question - how to install and use this code?
I know how to export and import yml ACL rule, but no idea how to use ACL pm file.

Ytigiev
OTRS newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
OTRS Version?: 6.0.14

Re: Dynamic Fields

Post by Ytigiev » 16 Apr 2019, 07:10

root wrote:
15 Apr 2019, 11:36
Hi,

Here's an example for an non-GUI ACL: https://github.com/OTRS/otrs/blob/rel-6 ... dChilds.pm

You can use the API (https://doc.otrs.com/doc/api/otrs/6.0/P ... nd.pm.html) to add values parsed from anywhere to a Dynamic Field.

- Roy
Please, provide a link on documentation on how to write and deploy non-GUI ACL.

This is a good sample but is not enough.
Is it enough just put my own code in the folder
1) /opt/otrs/Kernels/System/Ticket/Acl
or
2) /opt/otrs/Custom/Kernels/System/Ticket/Acl?

Should I register this module in the system?
If yes then how to register it?
Any additional steps if needed

Post Reply