Dependant Dynamic Fields?

Moderator: crythias

Post Reply
tcs
Znuny newbie
Posts: 6
Joined: 21 Mar 2012, 21:19
Znuny Version: OTRS312

Dependant Dynamic Fields?

Post by tcs »

Is there a way to have Dynamic fields appear or have their choosable options change depending on other dynamic fields?

What I'd love to be able to do is have a user select a dropdown dynamic field for "Room," and depending on what Room they are in they can choose hardware specific to that room from another dropdown or list. So if they are in room A - one list of hardware will be listed, and if they're in room B then another list will be shown. Does that make sense? Is this doable or is there another way I'm not thinking of?

Thanks.
OTRS 3.1.2 on Ubuntu 10.04 on vSphere Hypervisor ESXi
tcs
Znuny newbie
Posts: 6
Joined: 21 Mar 2012, 21:19
Znuny Version: OTRS312

Re: Dependant Dynamic Fields?

Post by tcs »

Bump...

I can't imagine I'm the first one to look into this.
OTRS 3.1.2 on Ubuntu 10.04 on vSphere Hypervisor ESXi
Lio
Znuny newbie
Posts: 11
Joined: 13 Dec 2011, 10:50
Znuny Version: 3
Company: Gateway Communications
Location: Belgium

Re: Dependant Dynamic Fields?

Post by Lio »

I have to say, I'm also looking forward a similar functionality :)

I guess it's not native and that it will requires some ajax developement...
OTRS 3.1.1, Apache, Oracle running on Windows 2003 SP2 connected to an Active Directory for Agents.
yuri0001
Znuny superhero
Posts: 631
Joined: 17 Mar 2011, 14:40
Znuny Version: 5.0.6
Real Name: Yuri Kolesnikov
Location: Russia

Re: Dependant Dynamic Fields?

Post by yuri0001 »

Hi!
Yes, you can do it with ACL feature - see Admin manual chapter 18. There you can find examples.
Best regards Yuri Kolesnikov
OTRS 5.0.14, ITSM 5.0.14
SUSE 13.2, MariaDB 10.0.22(productive)
OTRS 5.0.14, ITSM 5.0.14(test)
tcs
Znuny newbie
Posts: 6
Joined: 21 Mar 2012, 21:19
Znuny Version: OTRS312

Re: Dependant Dynamic Fields?

Post by tcs »

For me the ACLs never remove any entries marked as PossibleNot - it just greys them out and makes them unelectable. I really need them to be hidden so as not to overwhelm the users with a bunch of inapplicable things to choose from.

After more searching, I've also found that what you can do is use Services and Service Level Agreements to get this functionality for at least 2 levels. I then used a custom language translation file (/opt/otrs/Kernel/Language/en_Custom.pm) to translate "Service Level Agreement" and "SLA" to "Equipment/Software" and "Service" to "Room/Location."

It's not really ideal, but this way people can choose a room and then be able to choose from a list of hardware or applications specific to only that room.
OTRS 3.1.2 on Ubuntu 10.04 on vSphere Hypervisor ESXi
yuri0001
Znuny superhero
Posts: 631
Joined: 17 Mar 2011, 14:40
Znuny Version: 5.0.6
Real Name: Yuri Kolesnikov
Location: Russia

Re: Dependant Dynamic Fields?

Post by yuri0001 »

Use Possible, not PossibleNot and be happy. I think it more coding, but work.
Example:

Code: Select all

    $Self->{TicketAcl}->{'600 - Category --> ProjectName_1'} = {
    Properties => {
	    DynamicField => {
            # keys must be in DynamicField_<field_name> format
           DynamicField_CategoryName  => ['015'],
           },
		},   
    Possible => {
        Ticket => {
            DynamicField_ProjectName  => ['02 Cartrige', '04 DrumUnit'],
           },
        },    
	};
    $Self->{TicketAcl}->{'610 - Category --> ProjectName_2'} = {
    Properties => {
	    DynamicField => {
            # keys must be in DynamicField_<field_name> format
           DynamicField_CategoryName  => ['001'],
           },
		},   
    Possible => {
        Ticket => {
            DynamicField_ProjectName  => ['01 Toner', '03 Fuser'],
           },
        },    
	};
Your idea about Service and SLA as dependent fields feature may be works, not right
Best regards Yuri Kolesnikov
OTRS 5.0.14, ITSM 5.0.14
SUSE 13.2, MariaDB 10.0.22(productive)
OTRS 5.0.14, ITSM 5.0.14(test)
girishmungra
Znuny newbie
Posts: 59
Joined: 24 Jul 2012, 18:20
Znuny Version: 3.1.7
Real Name: Girish Mungra

Re: Dependant Dynamic Fields?

Post by girishmungra »

Hi Yuri,

I tried the above codes and they doesn't seem to work:

$Self->{TicketAcl}->{'300-Restrict Classification list-ACL'} = {
Properties => {
Ticket => {
Queue => ['Support'],
}
},
Possible => {
Ticket => {
DynamicField_Category => ['Hardware', 'Software'],
},
},
};

$Self->{TicketAcl}->{'310 Subcategory depending on above classification-ACL'} = {
Properties => {
DynamicField => {
DynamicField_Category => ['Hardware'],
},
},
Possible => {
Ticket => {
DynamicField_Subcategory => ['Printer', 'PC'],

},
},
};

Help much appreciated. Thanks
OTRS 3.1.7 on Linux RedHat with MySQL database connected to an Active Directory for Agents and Customers.
eterjack
Znuny newbie
Posts: 55
Joined: 21 Sep 2012, 01:45
Znuny Version: 3.1.10

Re: Dependant Dynamic Fields?

Post by eterjack »

I need this too....
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Dependant Dynamic Fields?

Post by crythias »

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
eterjack
Znuny newbie
Posts: 55
Joined: 21 Sep 2012, 01:45
Znuny Version: 3.1.10

Re: Dependant Dynamic Fields?

Post by eterjack »

Humm thx for replie but not work.

Look this example, i need to create a dependency between theses 3 fields. categoria1, categoria2 and service.

categoria1:
1.1.Acesso
1.2.InfraEstrutura
1.3.Hardware
1.4.Software

categoria2:
1.1.1.Domain
1.1.2.Directory
1.1.3.Wifi
1.2.1.Network
1.2.2.Server
1.2.3.Switch
1.2.4.Access Point

Service:
1.1.1.1.Autentication
1.1.1.2.Security
1.1.1.3.Service
1.1.2.1.Autentication
1.1.2.2.Security
1.1.2.3.Service

ACL Example:

If used this ACL, the categoria2 show all options

$Self->{TicketAcl}->{'ACL-CAT1-CAT2-1.1'} = {
# match properties
# note we don't have Ticket => { because there's no ticket yet
Properties => {
DynamicField => {
DynamicField_categoria1 => ['[RegExp]^1.1'],
}
},
# return possible options
Possible => {
# possible ticket options
Ticket => {
DynamicField_categoria2 => ['[RegExp]^1.1.1'],
},
},
};

------------------------

If i replace DynamicField_categoria1 => ['[RegExp]^1.1'], for DynamicField_categoria1 => ['[RegExp]^1'] worked. Why ?


Add this lines, for reload values.

In AgentTicketPhone.dtl add this lines:

<!-- dtl:block:DynamicField_categoria1 -->
<div class="Row Row_DynamicField_$QData{"Name"}">
$Data{"Label"}
<div class="Field">
$Data{"Field"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#categoria1').bind('change', function (Event) {
Core.AJAX.FormUpdate($('#NewPhoneTicket'), 'AJAXUpdate', 'categoria1', [ 'TypeID', 'Dest', 'NewUserID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
});
//]]></script>
<!--dtl:js_on_document_complete-->
</div>
<div class="Clear"></div>
</div>
<!-- dtl:block:DynamicField_categoria1 -->
<!-- dtl:block:DynamicField_categoria2 -->
<div class="Row Row_DynamicField_$QData{"Name"}">
$Data{"Label"}
<div class="Field">
$Data{"Field"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#categoria2').bind('change', function (Event) {
Core.AJAX.FormUpdate($('#NewPhoneTicket'), 'AJAXUpdate', 'categoria2', [ 'TypeID', 'Dest', 'NewUserID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
});
//]]></script>
<!--dtl:js_on_document_complete-->
</div>
<div class="Clear"></div>
</div>
<!-- dtl:block:DynamicField_categoria2 -->
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Dependant Dynamic Fields?

Post by crythias »

by the way, period matches "any single character" in RegEx. You must slash escape it "\." to recognize it as a period.
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
eterjack
Znuny newbie
Posts: 55
Joined: 21 Sep 2012, 01:45
Znuny Version: 3.1.10

Re: Dependant Dynamic Fields?

Post by eterjack »

Thx for replay, but dont work.

With "\." nothing happens, when refresh fields

Properties => {
# 1.[x]
DynamicField => {
DynamicField_categoria1 => ['[RegExp]^1\.1'],
}
},

root@ubuntu:/opt/otrs# tail -f /var/log/syslog | grep 'ACL-CAT1-CAT2-1.1'

When:

Properties => {
# 1.[x]
DynamicField => {
DynamicField_categoria1 => ['[RegExp]^1'],
}
},

Matchs, and ACL is read.

root@ubuntu:/opt/otrs# tail -f /var/log/syslog | grep 'ACL-CAT1-CAT2-1.1'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7420] Workflow 'ACL-CAT1-CAT2-1.1/DynamicField/DynamicField_categoria1' Matched ([RegExp]^1 eq 1)
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7483] Matched Workflow 'ACL-CAT1-CAT2-1.1'->'Queue'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7420] Workflow 'ACL-CAT1-CAT2-1.1/DynamicField/DynamicField_categoria1' Matched ([RegExp]^1 eq 1)
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7483] Matched Workflow 'ACL-CAT1-CAT2-1.1'->'Owner'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7420] Workflow 'ACL-CAT1-CAT2-1.1/DynamicField/DynamicField_categoria1' Matched ([RegExp]^1 eq 1)
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7483] Matched Workflow 'ACL-CAT1-CAT2-1.1'->'Responsible'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7420] Workflow 'ACL-CAT1-CAT2-1.1/DynamicField/DynamicField_categoria1' Matched ([RegExp]^1 eq 1)
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7483] Matched Workflow 'ACL-CAT1-CAT2-1.1'->'State'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7420] Workflow 'ACL-CAT1-CAT2-1.1/DynamicField/DynamicField_categoria1' Matched ([RegExp]^1 eq 1)
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7483] Matched Workflow 'ACL-CAT1-CAT2-1.1'->'Priority'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7420] Workflow 'ACL-CAT1-CAT2-1.1/DynamicField/DynamicField_categoria1' Matched ([RegExp]^1 eq 1)
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7483] Matched Workflow 'ACL-CAT1-CAT2-1.1'->'Service'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7420] Workflow 'ACL-CAT1-CAT2-1.1/DynamicField/DynamicField_categoria1' Matched ([RegExp]^1 eq 1)
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7483] Matched Workflow 'ACL-CAT1-CAT2-1.1'->'SLA'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7420] Workflow 'ACL-CAT1-CAT2-1.1/DynamicField/DynamicField_categoria1' Matched ([RegExp]^1 eq 1)
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7483] Matched Workflow 'ACL-CAT1-CAT2-1.1'->'DynamicField_categoria1'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7420] Workflow 'ACL-CAT1-CAT2-1.1/DynamicField/DynamicField_categoria1' Matched ([RegExp]^1 eq 1)
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7483] Matched Workflow 'ACL-CAT1-CAT2-1.1'->'DynamicField_categoria2'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7518] Workflow 'ACL-CAT1-CAT2-1.1' used with Possible:'Ticket:DynamicField_categoria2'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7554] Workflow 'ACL-CAT1-CAT2-1.1' param '1.1.2.Diretorio/pastas' used with Possible:'Ticket:DynamicField_categoria2'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7554] Workflow 'ACL-CAT1-CAT2-1.1' param '1.1.1.Dominio' used with Possible:'Ticket:DynamicField_categoria2'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7554] Workflow 'ACL-CAT1-CAT2-1.1' param '1.1.3.Wifi' used with Possible:'Ticket:DynamicField_categoria2'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7554] Workflow 'ACL-CAT1-CAT2-1.1' param '1.1.4.E-mail' used with Possible:'Ticket:DynamicField_categoria2'
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7420] Workflow 'ACL-CAT1-CAT2-1.1/DynamicField/DynamicField_categoria1' Matched ([RegExp]^1 eq 1)
Oct 16 10:54:21 ubuntu OTRS-CGI-10[5222]: [Debug][Kernel::System::Ticket::TicketAcl][7483] Matched Workflow 'ACL-CAT1-CAT2-1.1'->'DynamicField_MasterSlave'
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Dependant Dynamic Fields?

Post by crythias »

<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#categoria2').bind('change', function (Event) {
Core.AJAX.FormUpdate($('#NewPhoneTicket'), 'AJAXUpdate', 'categoria2', [ 'TypeID', 'Dest', 'NewUserID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
});
//]]></script>

This says it'll do an "onchange" for a field that has an HTML DOM id of categoria2.
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
eterjack
Znuny newbie
Posts: 55
Joined: 21 Sep 2012, 01:45
Znuny Version: 3.1.10

Re: Dependant Dynamic Fields?

Post by eterjack »

ACL compares the key {number} the DynamicField with the string value of the service.

Is there a way to use the value of the key instead of the key DynamicField
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Dependant Dynamic Fields?

Post by crythias »

You need to bind the action to the field id. ACL will provide the values based upon the name= of the field.

It works like this:
user changes the value of the field (name="DynamicField_categoria2")
javascript (actually, in this case, jquery) says, look for an html tag with an id of 'categoria2' (This doesn't exist. DynamicField_categoria2 exists, probably)
and then make that field do an onchange which updates the Form with an id of NewPhoneTicket,
pass "AJAXUpdate" as a parameter
pass "categoria2" as the field (name=) to grab information from (should be DynamicField_categoria2)
pass an array of fields to update [x,y,z, 'DynamicField_categoria3'] when the bound field is changed
fields are updated based upon, for instance, ACL logic.
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
Post Reply