Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

Syntax for adding a ticket field as search criteria in customer centre view tickets area

At Customer centre when a customer has logged in to view his/hers tickets , there is an option to search:

 

this searchtext only search for the freetext field it seem.

 

here is how the listTickets.html looks like:

_________________________________________________

<div id='listTickets'>

<div id='ticketBox'>
<!-- <div id='ticketSummary'>
<span class='active'>%numActiveTickets% aktiva</span>
<span>%numNotReadTickets% uleste</span>
<span>%numClosedTickets% avslutad</span>
</div>
-->
<div id='ticketSearch'>
<form method="post" action="%AuthProgram%&action=listTickets">
<input type="text" class='smartField' alt='Sök i ärenden' name="searchText" size="20" value="%searchText%">
<img src='%WwwRoot%graphics/SevenCustomer/search.png' alt='Search'/>
<input type="hidden" name="pageLength" value="%pageLength%">
<input type='hidden' name='ok' value='1' />
<!--<input type="submit" class="submitButton" name="ok" value="Søk">-->
</form>
</div>
</div>

 

<!-- Start filtering code -->
%EJSCRIPT_START%
<%
print("<div>");
//print("<div id='ticketSummary'>");
//print("<div style='clear: both; height: 5px; width: 1px;'>&nbsp;</div>\n");
// print("<div style='clear: both; height: 5px; width: 1px;'>&nbsp;</div>\n");

SearchEngine se;
se.addField("person.showContactTickets");
se.addCriteria("person.person_id", "Equals", getParserVariable("customer.id"), "And", 0);
// se.addCriteria("ticket.x_oitp_serienr", "Equals", %searchText%);
if(se.select() > 0)
{
if(getCgiVariable("filterBy") != "own"){

_____________________________________________________________________________

in this commented row I am trying to add a field from ticket to be searched for

 //se.addCriteria("ticket.x_oitp_serienr", "Equals", %searchText%);

 This syntax is not correct but would that be enough to inlcude ticket.x_oitp_serienr as a valid search criteria ?

RE: Syntax for adding a ticket field as search criteria in customer centre view tickets area

Hi,

Unless you prefer to write your own code for this screen, it should be possible to specify which fields you want to make searchable by adding this inside your form element.

<input type="hidden" name="searchWhat" value="ticket.id,ticket.title,ticket.x_my_hidden" />
Von: Michel Krohn-Dale 15. Apr 2021

RE: Syntax for adding a ticket field as search criteria in customer centre view tickets area

Thanks Michel ! Works fine now :)

Von: Henrik Laitinen 15. Apr 2021