this api库,我正在成功创建zendesk票证,但问题是我无法将所有表单字段发送到zendesk票证表单。只有主题和描述字段数据通过我的代码发送。
这是我的网络表单
这是我的机票单
这是我的机票清单
这是我创建票证的代码
public function CreateTicketOnZendesk($subject,$email,$description,$transactionNumber){ try{ $client = $this->zendesk(); $newTicket = $client->tickets()->create([ 'subject' => $subject, 'comment' => [ 'body' => $description ], 'custom_fields'=>[ 'email' => $email, 'transaction_number' => $transactionNumber, ], 'priority' => 'normal' ]); return true; }catch(\Exception $e){ error_log($e->getMessage()); } }
但无法发送电子邮件和交易编号字段数据。尝试添加这些字段,如发送主题。
自定义字段应作为 id value custom_fields . 要获取字段id,您可以转到zendesk上的“票证字段”面板,也可以使用此api api/v2/ticket_fields.json
id
value
custom_fields
api/v2/ticket_fields.json
'custom_fields'=>[ [ 'id'=> '<email_field_id>', 'value'=> $email ], [ 'id'=> '<transaction_number_field_id>', 'value'=> $transactionNumber ] ],