CUSTOMER CENTRE SOURCE FILES

I am editing the newTicket.html and would like to make this category dropdown to show one of two textboxes depending on the choice.

If the name of the category start with 'Abc' for ex textbox A is shown and the data entered should go back to ticket.x_machine. If category is another specific choice ,  textbox B is shown, data entered is sent back to ticket.x_volume

newTicket.html

%IF:category%
<label>Choose category</label>
%IF:noCategory="1"%
<span class='errorText'>Error: the system does not contain a valid category for your inquiry. Please contact the system administrator.</span>
%ENDIF%

%category%<br>

Question nr 1) Where can I find the parsers like in this instance category ?

I did find an old(?) link here but category is not listed:

https://community-sod.superoffice.com/en/technical/documentation/CS/parser-variables/

Anyone out there who has solved this in a nice way ?

 

framework.html refers to 

<script type='text/javascript' src='%WwwRoot%javascript/jquery-1.11.2.min.js'></script>
<script type='text/javascript' src='%WwwRoot%javascript/customer.js'></script>

 

 

RE: CUSTOMER CENTRE SOURCE FILES

Hi Henrik,

to display all available parser variables, use %PARSER_TREE%

But to solve your needs, I would use Javascript instead.

Something along the lines of:

$(document).ready(function(){
  $('#category').on('change', function(){
    var thisVal = $(this).val();
    if(thisVal.startsWith('abc')) {
      // Show some input files
    } else {
      // Show other input files
    }
  });
});
By: Simen Mostuen Iversen 18 Feb 2021

RE: CUSTOMER CENTRE SOURCE FILES

Hi

I cannot get hold of my created extra field in ticket called x_maskinr in my script. I assume that my script is not in the correct location since the ticket.x_maskinnr isnt available ?

 

<script type="text/javascript">
$(function () {

$('select[name="category"]').change(function () {
var selectedText = $(this).find("option:selected").text();
var selectedValue = $(this).val();
var infra= selectedText .startsWith("Infra");

if (infra==true)
{ alert ("Visa maskinnr");

document.getElementById("x_maskinnr").style.visibility = 'visible';

}
else
{ alert ("Best volym");

}

 

 

How do I get hold of this ticket field:

 

var example = document.getElementById("x_maskinnr");
alert(example);

Tested and its null aka not accessible

 

By: Henrik Laitinen 24 Feb 2021

RE: CUSTOMER CENTRE SOURCE FILES

Inspect the element and see the name or ID.

Can you provide some more information?

By: Simen Mostuen Iversen 24 Feb 2021

RE: CUSTOMER CENTRE SOURCE FILES

Hi Simen

The element is this

 

i see no ID here only name category but depending on what category is picked a certain ticket field should appear, in this example the field ticket.x_maskinnr

By: Henrik Laitinen 24 Feb 2021

RE: CUSTOMER CENTRE SOURCE FILES

Well, your error message states that it cannot find the element x_maskinnr, so apparently it's not the correct ID. Are you sure it's not: ticket_x_maskinnr ? Can you right click and inspect the element and see what the x_maskinnr field is like?

I would do it like this instead:

$(function () {

	$('select[name="category"]').change(function () {
		var selectedText = $(this).find("option:selected").text();
		var isInfra = selectedText.startsWith("Infra");

		$('#x_maskinnr').hide();
		if (isInfra) { 
			if($('#x_maskinnr').length > 0) {
				$('#x_maskinnr').show();
			}
		}
	});

});
By: Simen Mostuen Iversen 24 Feb 2021

RE: CUSTOMER CENTRE SOURCE FILES

Hi Simen

What I am trying to do is display an empty textbox and the content you put in there will be saved into ticket.x_maskinnr (that is the DB field name)

Since this is a new request in creation I cannot show that field right ?

By: Henrik Laitinen 24 Feb 2021

RE: CUSTOMER CENTRE SOURCE FILES

Not sure I entirely understand what you're saying, but as I've understood the field ticket.x_maskinnr has been created and configured to be shown in the Customer Centre, right?

If you've done this, and are using the standard Customer Centre, the field will be called ticket_x_maskinnr:

Then based on the selected category, you'll need to hide and show ticket_x_maskinnr (and the previous label), not x_maskinnr.

By: Simen Mostuen Iversen 24 Feb 2021

RE: CUSTOMER CENTRE SOURCE FILES

Hi

What should show after $('#ticket_x_maskinnr').show(); is run ?

By: Henrik Laitinen 24 Feb 2021