Queues - Hide/Show Dynamic fields

Moderator: crythias

Locked
blastik
Znuny newbie
Posts: 49
Joined: 24 Feb 2012, 09:59
Znuny Version: 5.0.16
Location: Barcelona, Spain
Contact:

Queues - Hide/Show Dynamic fields

Post by blastik »

I didnt know that! Thank you!

I have a couple more questions if you dont mind but i dont want to create another thread...

I need to hide a DynamicField from a Queue. The dynfield name is TicketFreeText15 and the label is Platform. The queue where that dynfield must be hidden is called Operations. Having a look to this thread viewtopic.php?t=24116 i understood that you have to add the following code after the Copyright disclaimer inside AgentTicketEmail.dtl ?

Code: Select all

<script type="text/javascript">//<![CDATA[
function nonetext() {
    $("[id^=DynamicField]").parent().addClass( 'Hidden' );
    $("[id^=LabelDynamicField]").parent().addClass('Hidden');
}
    $('#Dest').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#NewPhoneTicket'), 'AJAXUpdate', 'Dest', ['TypeID', 'NewUserID', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', 'To', 'Cc', 'Bcc', 'StandardTemplateID' $Data{"DynamicFieldNamesStrg"}]);
    switch ( $('#Dest').val() ) {
            case "3\|\|Junk": // need to slash escape the pipes. Also, need to be in numerical order
                nonetext();
                $('#DynamicField_myField').parent().removeClass( 'Hidden' );
                $('#LabelDynamicField_myField').parent().removeClass( 'Hidden' );
            break;
            default:
                nonetext();

        }
    });
//]]></script>
The modification for my setup should be something like...

Code: Select all

<script type="text/javascript">

function nonetext() {
        $("#DynamicField_TicketFreeText15").parent().hide();
        $("#LabelDynamicField_Platform").parent().hide();
    }

$('#Dest').change(function(){
   selection = $(this).val();   
   switch(selection)
   {
      case "3\|\|Operations":
          nonetext();
           $('#DynamicField_TicketFreeText15').parent().show();
           $('#LabelDynamicField_Platform').parent().show();
     break;
  
   default:
           nonetext();        
   }
});
nonetext();
</script>
Is that right ? I dont understand the "Also, need to be in numerical order" comment. Maybe is the situation of the chosen queue counting from 1? So that would be ... (1) QueueA (2) QueueB....

Thanks!
David
OTRS 5
Ubuntu with MySQL
Authenticating users & agents via LDAP
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Several questions

Post by crythias »

Just like tickets, it's best that each forum question is its own topic. It doesn't cost anything (here, to create a new topic) and helps us know when a question/topic has been answered so we don't have to revisit it.
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
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Queues - Hide/Show Dynamic fields

Post by crythias »

blastik wrote:Also, need to be in numerical order
Each "case" is parsed sequentially and should be ordered alphabetically/sequentially.

case "3\|\|Junk":
...

case "4\|\|something":
....
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
blastik
Znuny newbie
Posts: 49
Joined: 24 Feb 2012, 09:59
Znuny Version: 5.0.16
Location: Barcelona, Spain
Contact:

Re: Queues - Hide/Show Dynamic fields

Post by blastik »

Sorry guys but i'm unable to hide a dynamic field "TicketFreeText15" with label "Platform" at the "Operations" queue. I'm adding the following code at the very beginning of AgentTicketCompose.dtl and AgentTicketClose.dtl. Any hints?

Code: Select all

<script type="text/javascript">//<![CDATA[
function nonetext() {
    $("[id^=DynamicField]").parent().addClass( 'Hidden' );
    $("[id^=LabelDynamicField]").parent().addClass('Hidden');
}
    $('#Dest').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#NewPhoneTicket'), 'AJAXUpdate', 'Dest', ['TypeID', 'NewUserID', 'NewResponsibleID', 'NextStateID$
    switch ( $('#Dest').val() ) {
            case "3\|\|Operations": // need to slash escape the pipes. Also, need to be in numerical order
                nonetext();
                $('#DynamicField_TicketFreeText15').parent().removeClass( 'Hidden' );
                $('#LabelDynamicField_Platform').parent().removeClass( 'Hidden' );
            break;
            default:
                nonetext();

        }
    });
//]]></script>
Thanks!
D.
OTRS 5
Ubuntu with MySQL
Authenticating users & agents via LDAP
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Queues - Hide/Show Dynamic fields

Post by crythias »

Did you rename the queue with ID=3 from Junk to Operations? Does the queue for Operations have ID=3?
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
blastik
Znuny newbie
Posts: 49
Joined: 24 Feb 2012, 09:59
Znuny Version: 5.0.16
Location: Barcelona, Spain
Contact:

Re: Queues - Hide/Show Dynamic fields

Post by blastik »

Sorry... :roll: Where do I see the ID ?
OTRS 5
Ubuntu with MySQL
Authenticating users & agents via LDAP
blastik
Znuny newbie
Posts: 49
Joined: 24 Feb 2012, 09:59
Znuny Version: 5.0.16
Location: Barcelona, Spain
Contact:

Re: Queues - Hide/Show Dynamic fields

Post by blastik »

Ah! found it! Its Queue ID 13, but ive changed it and I still can see the Dynamic Field in there when I reply an email article...
OTRS 5
Ubuntu with MySQL
Authenticating users & agents via LDAP
Locked