FetchConfiguration 構造:iOS

  • リリースバージョン: Zurich
  • 更新日 2025年07月31日
  • 所要時間:3分
  • FetchConfiguration 構造は、ServiceNow インスタンスからレコードをフェッチするための構成を定義する機能を提供します。

    表 : 1. プロパティ
    名前 タイプ 説明
    フィルター フィルター オプション。返される結果に適用するクエリ。たとえば、「broken」という単語を含む簡単な説明を含むアクティブなレコードのみを返すには、active=true^というクエリを渡しますshort_descriptionLIKEbroken

    デフォルト:nil:フィルターは適用されず、すべてのレコードが返されます (システムまたはテーブルの制限が適用されます)。

    limit 整数 オプション。ページ/応答ごとに返されるレコードの数。

    デフォルト:nil - すべてのレコードが返されます (システムまたはテーブルの制限が適用されます)。

    readConfiguration FieldReadConfiguration オプション。応答で返されるフィールドの構成。

    デフォルト:nil - すべてのフィールドが返されます。

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

    REST エンドポイントを介して ServiceNow インスタンスからデータをフェッチするときに返すレコードおよびそれらのレコード内の関連フィールドの基準を定義します。

    表 : 2. パラメーター
    名前 タイプ 説明
    フィルター フィルター オプション。返される結果に適用するクエリ。たとえば、「broken」という単語を含む簡単な説明を含むアクティブなレコードのみを返すには、active=true^というクエリを渡しますshort_descriptionLIKEbroken

    デフォルト:nil:フィルターは適用されず、すべてのレコードが返されます (システムまたはテーブルの制限が適用されます)。

    limit 整数 オプション。ページ/応答ごとに返されるレコードの数。

    デフォルト:nil - すべてのレコードが返されます (システムまたはテーブルの制限が適用されます)。

    readConfiguration FieldReadConfiguration オプション。応答で返されるフィールドの構成。

    デフォルト:nil - すべてのフィールドが返されます。

    表 : 3. 返される内容
    タイプ 説明
    なし

    テーブル 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)
    }()