[SOLVED] OTRS Soap Ticket Search Ignoring Dynamic Fields

Moderator: crythias

Locked
chrisvwn
Znuny newbie
Posts: 8
Joined: 25 Feb 2014, 18:48
Znuny Version: OTRS v3.3

[SOLVED] OTRS Soap Ticket Search Ignoring Dynamic Fields

Post by chrisvwn »

From my research, I have seen that this issue was experienced in earlier versions of OTRS and should have been resolved by now in v 3.3.5. However, I cannot seem to figure out how to get my query to take conditions based on dynamic fields taken into account.

My query returns a count of all 'closed successful' tickets in the system meaning that it is recognizing the States criteria but ignoring the DynamicField conditions. Is it my query? I am using PHP SoapClient and my dynamic fields are named ComplaintOrReview and CompanyName.

Code: Select all


$cnt_tkt_closed_succ = $client->__soapCall("Dispatch",
array($username, $password,
"TicketObject", "TicketSearch",
"Result", 'COUNT',
"States", array('closed successful'),
"DynamicField_CompanyName", array("Equals",$name),
"DynamicField_ComplaintOrReview", array("Equals","Complaint"),
"Permission",'ro',
"UserID", 1
));

Another question that has been addressed before but is still stumping me is how to turn on debug in the soap ticket search. I have tried adding '$Self->{Debug} = 3' in Kernel/System/TicketSearch.pm and ./Kernel/GenericInterface/Operation/Ticket/TicketSearch.pm to no avail. Debug only shows Config.pm?
Last edited by chrisvwn on 27 Mar 2014, 15:11, edited 1 time in total.
OTRS v3.3 private testing on Fedora 18 with Apache and MySQL
chrisvwn
Znuny newbie
Posts: 8
Joined: 25 Feb 2014, 18:48
Znuny Version: OTRS v3.3

Re: OTRS Soap Ticket Search Ignoring Dynamic Fields

Post by chrisvwn »

Finally solved.

The Dynamic Fields in the soap request must be hashes or as they are called in php, associative arrays. See this: http://stackoverflow.com/questions/8857 ... ash-in-php

So while the rest of the request was fine being sent in as an array, I had to change the dynamic fields to look like so: array("Equals"=>$name)

Code: Select all


$cnt_tkt_closed_succ = $client->__soapCall("Dispatch",
array($username, $password,
"TicketObject", "TicketSearch",
"Result", 'COUNT',
"States", array('closed successful'),
"DynamicField_CompanyName", array("Equals"=>$name),
"DynamicField_ComplaintOrReview", array("Equals"=>"Complaint"),
"Permission",'ro',
"UserID", 1
));

As for debugging in TicketSearch.pm I quote reneeb from this thread: viewtopic.php?f=62&t=23542&p=92839&hilit=debug#p92839
Then you should debug! Add lots of lines like

$Self->{LogObject}->Log( Priority => error => Message => "<Message>" );

to the code (Kernel/Modules/CustomerTicketSearch.pm), and replace <Message> with a value that helps you to debug the code.
OTRS v3.3 private testing on Fedora 18 with Apache and MySQL
Locked