The FieldReadConfiguration structure enables you to configure which fields to fetch from a ServiceNow instance table and in which format.

Table 1. Properties
Name Type Description
includeFields Array List of fields to pass back in the return results.
options Array List of the types of fields to return.
Possible values:
  • actualValues: Returns the values actually stored in each of the fields, including the sys_ids for referenced records. Use this setting if dates need to be decoded in Codable models using Date.
  • description: Returns the description of the parameter.
  • displayValues: Returns the display values, if available, for the selected fields. For example, user names typically contain a reference link (sys_id) to the user record. If you request the display value, the person's name is returned instead of the sys_id that is stored in the associated field.
    Note: Display values returned by a ServiceNow instance are formatted and internationalized based on the user profile configuration of the authenticated user. This may differ from the device language and locale settings on the device.
  • excludeReferenceLink: Does not return any data that is defined as reference links within the table.
  • rawValue: Returns the raw value of the parameter.

FieldReadConfiguration init(includeFields: [FieldName] = [], options: Options = [])

Configures the fields within a record in a ServiceNow table to pass back in the return results of a REST endpoint call.

Table 2. Parameters
Name Type Description
includeFields Array List of fields to pass back in the return results.
options Array List of the types of fields to return.
Possible values:
  • actualValues: Returns the values actually stored in each of the fields, including the sys_ids for referenced records. Use this setting if dates need to be decoded in Codable models using Date.
  • description: Returns the description of the parameter.
  • displayValues: Returns the display values, if available, for the selected fields. For example, user names typically contain a reference link (sys_id) to the user record. If you request the display value, the person's name is returned instead of the sys_id that is stored in the associated field.
    Note: Display values returned by a ServiceNow instance are formatted and internationalized based on the user profile configuration of the authenticated user. This may differ from the device language and locale settings on the device.
  • excludeReferenceLink: Does not return any data that is defined as reference links within the table.
  • rawValue: Returns the raw value of the parameter.
Table 3. Returns
Type Description
None

Example

The following code example shows how to call this function.

/// 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("opened_at")], queryCategory: nil)
  return FetchConfiguration(filter: filter, limit: 10, readConfiguration: readConfiguration)
}()