Dynamic Fields WIth New Tickets and Queue Selectation

Moderator: crythias

Locked
Naglix
Znuny newbie
Posts: 19
Joined: 03 Mar 2014, 14:36
Znuny Version: 3.3.x

Dynamic Fields WIth New Tickets and Queue Selectation

Post by Naglix »

Good day,

I can't seem to find a Forum regarding my Issue at hand,
Herewith my following Delama:

When a Customer selects a new Ticket, there is a field call "TO" Which can be select for Printer issues, Network issues, or Hardware list goes on.
This are all the Queues We have setup, When a Customer select the Printer Queue, a dynamic Field should show for the sub Queues of No Toner or Paper jam etc.

How can this be done and what are the Exact Steps taken to get the desired result?

If it comes to coding, Please be clear I don't have a Programming back ground.

Kind Regards,
System Info:
OTRS: 3.3.x
OS: Linux - Ubuntu
web services: Apache2
DB: postgre
Naglix
Znuny newbie
Posts: 19
Joined: 03 Mar 2014, 14:36
Znuny Version: 3.3.x

Re: Dynamic Fields WIth New Tickets and Queue Selectation

Post by Naglix »

I have gone through so many forum And nothing on what I would like to get
and Achieve, I do Hope you will take the Time to help me with this.
I did try this viewtopic.php?f=60&t=8032, but to
change it for Queues & Drop-down box.

What I would like to achieve is the following:

1. Select a Queue e.g. Printers
2. A drop-down Box via Dynamic Fields should Show with the Selection for Printers, e.g No Paper, No Toner...etc
3. If you change your Queue to General IT a Different Drop-down Box should show.
4. Select General IT Queue, Drop-down box via Dynamic Fields should show, New User, New Equipment..etc.

Please take note, I did not study Programming or Coding. I do understand it
if its there but I can't for the Live off me Create my own code.
I do ask for your Patience and understanding.
System Info:
OTRS: 3.3.x
OS: Linux - Ubuntu
web services: Apache2
DB: postgre
Naglix
Znuny newbie
Posts: 19
Joined: 03 Mar 2014, 14:36
Znuny Version: 3.3.x

Re: Dynamic Fields WIth New Tickets and Queue Selectation

Post by Naglix »

Hi Please elaborate on the code?

I have Dynamic Fields:
ID:13 Name: CustomerGeneralIT
ID:12 Name: CustomerPrinterIssue

I have Queue:
ID:5 Name: General IT
ID:9 Name: Printers

How will this be intergrade into the following code to Show/Hide the Queue, If I select Printer Queue Dynamic Field CustomerPrinterIssue should show on the Ticket:
Herewith the code:
<script type="text/javascript">
Core.Customer.InitFocus();
//above two lines are already there
function nonetext() {
// you should only add lines in here that A) you have defined in SysConfig and B) that you will show ... somewhen (in the switch/case) but not all the time.
document.getElementById('TicketFreeText1').style.display = 'none';
document.getElementById('LabelTicketFreeText1').style.display = 'none';
document.getElementById('TicketFreeText2').style.display = 'none';
document.getElementById('LabelTicketFreeText2').style.display = 'none';
document.getElementById('TicketFreeText3').style.display = 'none';
document.getElementById('LabelTicketFreeText3').style.display = 'none';
document.getElementById('TicketFreeText4').style.display = 'none';
document.getElementById('LabelTicketFreeText4').style.display = 'none';
}
switch ($('#Dest').val() ) { //this is where the queue is relevant (Dest = Queue)
case "3\|\|Junk": // need to slash escape the pipes
document.compose.RichText.value = "This is junk<br/>and line 2"; // only if you want to change the body. destroys user input if queue changes
nonetext(); // This clears all the ticketfreetext listed before showing what you want
document.getElementById('TicketFreeText1').style.display = 'block';
document.getElementById('LabelTicketFreeText1').style.display = 'block';
break;
case "5\|\|AnotherQueue": //Don't forget to slash escape BOTH pipes.
document.compose.RichText.value = "This is another queue<br/>and line 2"; // only if you want to change the body. destroys user input if queue changes
nonetext(); // This clears all the ticketfreetext listed before showing what you want
document.getElementById('TicketFreeText2').style.display = 'block';
document.getElementById('LabelTicketFreeText2').style.display = 'block';
document.getElementById('TicketFreeText3').style.display = 'block';
document.getElementById('LabelTicketFreeText3').style.display = 'block';
document.getElementById('TicketFreeText4').style.display = 'block';
document.getElementById('LabelTicketFreeText4').style.display = 'block';
break;
default:
document.compose.RichText.value = $('#Dest').val(); //remove this. debug only. shows queue information
document.getElementById('TicketFreeText1').style.display = 'none';
document.getElementById('LabelTicketFreeText1').style.display = 'none';
System Info:
OTRS: 3.3.x
OS: Linux - Ubuntu
web services: Apache2
DB: postgre
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Dynamic Fields WIth New Tickets and Queue Selectation

Post by reneeb »

Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Dynamic Fields WIth New Tickets and Queue Selectation

Post by crythias »

If you want to show/hide values, use ACL see docs.
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
Naglix
Znuny newbie
Posts: 19
Joined: 03 Mar 2014, 14:36
Znuny Version: 3.3.x

Re: Dynamic Fields WIth New Tickets and Queue Selectation

Post by Naglix »

Thank you to Reneeb for putting me on the right way.

ACL did not work nor did they do anything, After going through OTRS Manual and other Forms regarding ACL with allot of Config and Testing, ACL was not helpful.

The Code from this Forum viewtopic.php?f=60&t=8032, Did do the trick.
From not having any Programming background, and reading up Java scripting with trail and Error. I got it to work as I wanted it.

Thank for the Code from crythias.
Thank you to Reneeb for clarifying, Some details.
System Info:
OTRS: 3.3.x
OS: Linux - Ubuntu
web services: Apache2
DB: postgre
Naglix
Znuny newbie
Posts: 19
Joined: 03 Mar 2014, 14:36
Znuny Version: 3.3.x

Re: Dynamic Fields WIth New Tickets and Queue Selectation

Post by Naglix »

With the following code, there are two section which I'm still trying to figure out,

I have left my Dynamic Field name in them, hope this is not an issues.

The first code at the top:

Code: Select all

// you should only add lines in here that A) you have defined in SysConfig and B) that you will show ... somewhere (in the switch/case) but not all the time.
	  document.getElementById('DynamicField_CustomerGeneralIT').style.display = 'block';
      document.getElementById('LabelDynamicField_CustomerGeneralIT').style.display = 'block';
	  document.getElementById('DynamicField_CustomerPrinterIssue').style.display = 'block';
      document.getElementById('LabelDynamicField_CustomerPrinterIssue').style.display = 'block';
	  document.getElementById('DynamicField_CustomerCellPhoneTelephone').style.display = 'block';
      document.getElementById('LabelDynamicField_CustomerCellPhoneTelephone').style.display = 'block'; 
What does this do? I can't find the change it does or see the result, can you please Inform me what this does exactly, or can I leave it out.

I do thank you for the time and reply

The Second code, Last Part:

Code: Select all

default:
      document.compose.RichText.value = $('#Dest').val(); //remove this. debug only. shows queue information
      document.getElementById('DynamicField_CustomerGeneralIT').style.display = 'none';
      document.getElementById('LabelDynamicField_CustomerGeneralIT').style.display = 'none';
	  document.getElementById('DynamicField_CustomerPrinterIssue').style.display = 'none';
      document.getElementById('LabelDynamicField_CustomerPrinterIssue').style.display = 'none';
	  document.getElementById('DynamicField_CustomerCellPhoneTelephone').style.display = 'none';
      document.getElementById('LabelDynamicField_CustomerCellPhoneTelephone').style.display = 'none';
Same here can't find the Result, or the change it does. Could you Please clarify this for me as well or can I skip it?
System Info:
OTRS: 3.3.x
OS: Linux - Ubuntu
web services: Apache2
DB: postgre
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Dynamic Fields WIth New Tickets and Queue Selectation

Post by crythias »

style.display = 'block' = show the content as "block"
style.display = 'none' = hide the content

viewtopic.php?f=60&t=24116 is a cleaned up version of the t=8032 and should be used in its place.

If "nothing works" it means ... something (what?)
a) isn't being shown at all (Sysconfig).
b) isn't being shown when the proper field is being chosen
c) isn't being hidden
d) some other thing that is not described.

The concept is... by default, hide everything ... except when the proper queue is chosen... and then show the field.

HOWEVER, the history of this topic:
Naglix wrote: When a Customer select the Printer Queue, a dynamic Field should show for the sub Queues of No Toner or Paper jam etc.
Which would be "normally" a "Service" instead of a dynamic field. And that is addressed via ACL here: viewtopic.php?f=60&t=11235
The current ACL docs include information on how to hide/show VALUES in a DynamicField relative to other fields.
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
Naglix
Znuny newbie
Posts: 19
Joined: 03 Mar 2014, 14:36
Znuny Version: 3.3.x

Re: Dynamic Fields WIth New Tickets and Queue Selectation

Post by Naglix »

Thank you for the reverence for the ACL,
This Code has been doing a good job and does what I need ;) viewtopic.php?f=60&t=8032

Only problem I have is that the Default Queue " -" shows all my Dynamic Fields, which I would like to hide at the Default Queue,
I have added this

Code: Select all

switch ($('#Dest').val() ) { //this is where the queue is relevant (Dest = Queue)
	case "\|\|-": //Don't forget to slash escape BOTH. pipes.
      document.compose.RichText.value = "This is Default<br><br/>and line 2"; // only if you want to change the body. destroys user input if queue changes
      nonetext(); // This clears all the ticketfreetext listed before showing what you want
      document.getElementById('DynamicField_CustomerGeneralIT').style.display = 'none';
      document.getElementById('LabelDynamicField_CustomerGeneralIT').style.display = 'none';
But its not doing the trick, any idea on how I can get this going?
The case part is what I Changed for the Default Queue, which is not working.
What would be the best thing to do to hide the Dynamic Fields at the Default Queue?

Thank you for the Time.
System Info:
OTRS: 3.3.x
OS: Linux - Ubuntu
web services: Apache2
DB: postgre
Locked