Estoy tratando de crear un .js (similar a Core.Agent.Znuny4OTRSShowPendingTimeIfNeeded.js ), cuya función principal es mostrar/habilitar un menú desplegable de campo dinámico específico cuando se selecciona una opción específica en el menú desplegable Estado siguiente. Todo esto, por ahora, solo afecta a la acción ATPending. Este es mi intento hasta ahora:
$(document).ready(function() { setTimeout(function() { const Action = Core.Config.Get("Action"); const SupportedActions = ["AgentTicketPending"]; if ($.inArray(Action, SupportedActions) !== -1) { if (Action === "AgentTicketPending") document.getElementsByClassName("Row Row_DynamicField_ApproverList")[0].style.visibility = "hidden"; $('#NewStateID').on('change', function() { const Option = $(this).val(); if (Option === 'pending approval') { document.getElementsByClassName("Row Row_DynamicField_ApproverList")[0].style.visibility = "visible"; } else if (Option !== 'pending approval') { document.getElementsByClassName("Row Row_DynamicField_ApproverList")[0].style.visibility = "hidden"; } } ); } }); }); Reanudar: cuando se selecciona el estado "pendiente de aprobación", se visualiza DF "Aprobador".

Este ejemplo utiliza la estructura típica de los archivos OTRS/Znuny JS. De esa manera, no necesita $(document).ready o un tiempo de espera. Supongo que también crea su propio archivo xml para cargar este JS globalmente. Debe usar las identificaciones para el estado si desea admitir más idiomas, usé StateID 4 (abierto) aquí. Espero que ayude.
"use strict"; var Core = Core || {}; Core.Agent = Core.Agent || {}; /** * @namespace Core.Agent.HideField * @memberof Core.Agent * @description * This namespace contains the functions for handling Agent.HideField. */ Core.Agent.HideField = (function (TargetNS) { /** * @name Init * @memberof Core.Agent.HideField * @function * @description * Initializes the module functionality. */ TargetNS.Init = function () { const SupportedActions = ["AgentTicketPending"]; const Action = Core.Config.Get("Action"); if ($.inArray( Action, SupportedActions) !== -1) { $('#NewStateID').on('change', function() { if (Action === "AgentTicketPending") { // use: // $("#NewStateID").children("option").filter(":selected").text() // to get the text of the selected option if ( $('#NewStateID').val() == "4" ) { // hide dynamic field $('.Row.Row_DynamicField_ApproverList').hide(); }else{ // show dynamic field $('.Row.Row_DynamicField_ApproverList').show(); } } }); } }; Core.Init.RegisterNamespace(TargetNS, 'APP_MODULE'); return TargetNS; }(Core.Agent.HideField || {}));