Hello, I created a custom form which contains a custom field named "TestTest" (both the "label" and the "variable" column in the GUI have the value "TestTest") and set it to required. Type is "short answer" and I assigned no validator. I assigned the custom form to a help topic. When I create a ticket using the JSON API with the correct topicId I always get the error "Unable to create new ticket: validation errors: 16: TestTest is a required field err: Missing or invalid data - check the errors and try again", although I submit data for this custom field named "TestTest". If I set the custom field to not required the ticket is created, however still no value is shown in the custom field. When I click edit on the ticket, however, I see the custom field and can assign data to it, so the help topic and custom forms assignment is correct. I don't really know what to try next. My code to create the ticket is basically this:
$ticket = array();
$ticket = $user;
$ticket = $user;
$ticket = $supportsubject;
$ticket = "bla";
$ticket = true;
$ticket = true;
$ticket = $_SERVER;
$ticket = 1;
$ticket = "this is the custom field that doesn't work";
$data = json_encode($ticket);
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_URL, $config);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'X-API-Key: ' . $config,
'Content-Length: ' . strlen($data))
);
$restext = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($httpcode == 201)
{
$rval = TRUE;
}
curl_close($ch);
Please help, thank you.osTicket 1.8.1.2