FetchConfiguration structure - iOS

  • Release version: Xanadu
  • Updated August 1, 2024
  • 1 minute to read
  • The FetchConfiguration structure provides the ability to define the configuration for fetching records from your ServiceNow instance.

    Table 1. Properties
    Name Type Description
    filter Filter Optional. Query to apply to the return results. For example, to return only active records with a short description that contains the word "broken", pass the following query: active=true^short_descriptionLIKEbroken

    Default: nil - No filter applied, all records returned (any system or table limits are honored.)

    limit Integer Optional. Number of records to return per page/response.

    Default: nil - All records returned (any system or table limits are honored.)

    readConfiguration FieldReadConfiguration Optional. Configuration of the fields returned in the response.

    Default: nil - All fields are returned.

    FetchConfiguration - init(filter: Filter? = nil, limit: Int? = nil, readConfiguration: FieldReadConfiguration? = nil)

    Defines the criteria for what records, and associated fields within those records, to return when fetching data from a ServiceNow instance through a REST endpoint.

    Table 2. Parameters
    Name Type Description
    filter Filter Optional. Query to apply to the return results. For example, to return only active records with a short description that contains the word "broken", pass the following query: active=true^short_descriptionLIKEbroken

    Default: nil - No filter applied, all records returned (any system or table limits are honored.)

    limit Integer Optional. Number of records to return per page/response.

    Default: nil - All records returned (any system or table limits are honored.)

    readConfiguration FieldReadConfiguration Optional. Configuration of the fields returned in the response.

    Default: nil - All fields are returned.

    Table 3. Returns
    Type Description
    None

    Shows how to configure the data to fetch from the Table API.

    /// The configuration for what to fetch from the Table API.
    lazy var fetchConfiguration: FetchConfiguration = {
      let includeFields = [
        // Case details
        "number",
        "short_description",
        "priority",
        "state",
        "opened_at",
        
        // Account details
        "account.name",
        "account.number",
        "contact.name",
        "contact.email",
        "contact_type",
    
        // Assignment
        "assignment_group.name",
        "assigned_to.name"
      ]
      let readConfiguration = FieldReadConfiguration(includeFields: includeFields, options: .actualValues)
      let filter = Filter(criteria: [], sortBy: [.desc("number")], queryCategory: nil)
      return FetchConfiguration(filter: filter, limit: 10, readConfiguration: readConfiguration)
    }()