HOWEVER, for the value of "CustomerUser" if I do not put in an existing registrered Customer or Agents email address in, it does not set anything for CustomerID and I can only see who the ticket came from based on the "From" field.
I am using this as a web form on our support website so that customers can hit our website and submit a ticket into our system. If they are forced to have a registered customer account in our OTRS already, it defeats the purpose of the web form. If they are already registered, they can just log into the Customer Portal and place a ticket that way.
I need to figure out how I can set the value of CustomerUser and or CustomerID to an email address that does not already exist in the database.
Previously using rpc.pl, I was able to do this no problem. No matter if the customer existed or not, whatever I passed in for CustomerUser, got set as the CustomerID and showed in my TicketOverview. Digging into the TicketCreate.pm in opt/otrs/Kernel/GenericInterface/Operation/Ticket/TicketCreate.pm it looks as if the customerUser does not exist, it will set it, but that does not seem to be working.
I would like to figure out how to regain that same functionality using the Generic Interface. Here is the code that I am using:
Code: Select all
<?php
if (isset($_POST["emailAddr"])) {
$url = 'http://otrs.xxxxxx.com/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnector';
$username = 'xxxxxxxxx';
$password = 'xxxxxxxxx';
//# Set up a new SOAP connection:
try {
$client = new SoapClient(null, array('location' => $url,
'uri' => 'ticketconnector:actions', // make sure it's the same as the namespace in network config of the webservice
'trace' => true,
'style' => SOAP_RPC,
'use' => SOAP_ENCODED));
} catch (Exception $e) {
echo "<h2>Exception Error!</h2>";
echo $e->getMessage();
}
var_dump($client);
$Operation = 'TicketCreate';
try {
$TicketID = $client->__soapCall($Operation, array(
new SoapParam($username, "UserLogin"),
new SoapParam($password, "Password"),
new SoapParam(array(
"Title" => $_POST["subject"],
"CustomerUser" => $_POST["emailAddr"], // this one must exist as a customer but I need it to accept it whether it is a user or not.
"CustomerID" => $_POST["emailAddr"],
"Queue" => "Support",
"State" => "new",
"PriorityID" => 3,
"Type" => "default"
), "Ticket"),
new SoapParam(array(
"Subject" => $_POST["subject"],
"Body" => $_POST["description"],
"ContentType" => 'text/html; charset=utf8'
), "Article") ,
new SoapParam(array(
"Name" => "company",
"Value" => $_POST["company"]
), "DynamicField")
));
} catch (SoapFault $fault) {
echo "REQUEST:\n".$client->__getLastRequest()."\n";
echo "RESPONSE:\n".$client->__getLastResponse()."\n";
echo "</pre>";
exit;
}
var_dump($TicketID);
}
?>