Developers: Working With Custom Fields

Wix Answers makes it straightforward to create custom fields and then create or update items, such as tickets or users, with values for these fields. If you configured any automatic actions for tickets, they can be run based on the values in your tickets' custom fields, either when the ticket is created or when the custom fields change. In addition, you can filter items based on their custom field values.

The steps to work with custom fields are:
  1. Create a custom field.
  2. Copy the custom field's auto-generated name; you will need it when setting or reading the field's value using the API.
    Note: For tickets, you must use the ticket GUID. For all other custom fields (users, agents, and companies), you use the auto-generated name.
  3. Create a ticket, user, agent, or company while passing the customFields parameter with the auto-generated field name (or GUID, for tickets) and the field value, or update the custom fields of a ticket or user. Note that an agent's custom fields are different from, and in addition to, the agent's user custom fields.

    The payload for this includes the following line (example):
1
2
3
4
5
6
7
8
{
  ...
  "customFields": {
    "dept-1": "development",
    "office": "Seattle"
  }
  ...
}
See the relevant API methods in the Tickets API (Add Ticket, Update a Ticket's Custom Fields), Users API (Add User, Update a User's Custom Fields), Agents API (Update an Agent's Custom Fields), and Company API (Update a Company's Custom Fields) pages.
Note: If You Intend to Configure Custom Fields Using a Webhook After Adding the Ticket
If you create a ticket, and then update custom fields in a ticket by calling an API using the webhook, you may want the webhook to rerun the automatic actions after setting the custom fields in the webhook. See Update Custom Fields in a Ticket.