Desk SDKs Android v1
Desk SDKs Android
Desk SDKs
Android
Version 1

Ticket fields

Copy link

With Ticket fields, you can save additional information on a ticket, and tickets can be classified in detail by utilizing the saved information.

Note: Refer to Prerequisite before saving additional ticket information.


Store additional information of a ticket

Copy link

Use the ticket.setCustomFields() method to add information to a ticket. The information must consist of a field and its value, and only the field already registered Settings > Ticket fields on the Sendbird Dashboard can be used.

Map<String, String> customFields = new HashMap<>();
customFields.put("product", "Desk");
customFields.put("line", String.valueOf(30));

ticket.setCustomFields(customFields, new Ticket.SetCustomFieldHandler() {
    @Override
    public void onResult(Ticket ticket, SendbirdException e) {
        if (e != null) {
            // Handle error.
        }

        // Additional information of the ticket is saved.
        // Some fields can be ignored if they aren't registered on the dashboard.
        // Values aren't saved if they don't match the data type of their fields.
    }
});

Note: You can store additional information of a ticket when creating a ticket.


Use a ticket field as a search filter

Copy link

You can filter tickets by adding a ticket field as a search filter to the getOpenedList() and getClosedList(). Tickets that have a value of the selected field will appear on the ticket list.

Map<String, String> customFieldFilter = new HashMap<>();
customFieldFilter.put("subject", "doggy_doggy");

Ticket.getOpenedList(OFFSET, customFieldFilter, new Ticket.GetOpenedListHandler() {
    @Override
    public void onResult(List<Ticket> tickets, boolean hasNext, SendbirdException e) {
        if (e != null) {
            // Handle error.
        }

        // offset += tickets.length; for the next tickets.
        // Implement your code to display the ticket list.
        List<Ticket> openedTicket = tickets;
        ...
    }
});