Dynamic Fields

English! place to talk about development, programming and coding
Post Reply
Ytigiev
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Dynamic Fields

Post by Ytigiev »

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
Znuny wizard
Posts: 336
Joined: 21 Apr 2014, 16:14
Znuny Version: 6.0.18

Re: Dynamic Fields

Post by fcasal »

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

Greetings.
Ytigiev
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Re: Dynamic Fields

Post by Ytigiev »

Can you provide an example?
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Dynamic Fields

Post by jojo »

check https://otrs.com

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

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
root
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Dynamic Fields

Post by root »

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
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

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

Do you want to contribute or want to know where it goes ?
Ytigiev
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Re: Dynamic Fields

Post by Ytigiev »

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>
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Dynamic Fields

Post by crythias »

That would be in the template. Maybe.
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
Ytigiev
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Re: Dynamic Fields

Post by Ytigiev »

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
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Dynamic Fields

Post by root »

Hi,

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

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

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

Do you want to contribute or want to know where it goes ?
Ytigiev
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Re: Dynamic Fields

Post by Ytigiev »

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
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Dynamic Fields

Post by root »

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
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

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

Do you want to contribute or want to know where it goes ?
Ytigiev
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Re: Dynamic Fields

Post by Ytigiev »

Did you create ACL rule for each parent record?
How do you load data into a dropdown from csv file?
root
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Dynamic Fields

Post by root »

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
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

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

Do you want to contribute or want to know where it goes ?
Ytigiev
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Re: Dynamic Fields

Post by Ytigiev »

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
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Dynamic Fields

Post by root »

Hi,

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

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

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

Do you want to contribute or want to know where it goes ?
Ytigiev
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Re: Dynamic Fields

Post by Ytigiev »

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
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Re: Dynamic Fields

Post by Ytigiev »

How to access to the key of DynamicFields_df in the ACL?
root
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Dynamic Fields

Post by root »

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

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

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

Do you want to contribute or want to know where it goes ?
Ytigiev
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Re: Dynamic Fields

Post by Ytigiev »

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
Znuny newbie
Posts: 23
Joined: 03 Dec 2018, 13:37
Znuny Version: 6.0.14

Re: Dynamic Fields

Post by Ytigiev »

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