Desk SDKs iOS v1
Desk SDKs iOS
Desk SDKs
iOS
Version 1

Ticket fields

Copy link

With Ticket fields, you can save additional information of 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. 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.

var customFields = [String: String]()
customFields["product"] = "Desk"
customFields["line"] = "\(30)"

ticket.setCustomFields(customFields) { (error) in
    guard error == nil else {
        // Handle error.
    }

    // Additional information of the ticket is added.
    // 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.

let customFieldFilter = ["subject": "doggy_doggy"]

SBDSKTicket.getOpenedList(withOffset: OFFSET, customFieldFilter: CUSTOM_FIELD_FILTER) { (tickets, hasNext, error) in
    guard error == nil else {
        // Handle error.
    }

    // offset += tickets.length; for the next tickets.
    // Implement your code to display the ticket list.
}