---
sourceDocument: Xanadu API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# AbstractDBObject - グローバル

# AbstractDBObject - グローバル {#ariaid-title1}

* リリースバージョン: Xanadu
* 
* 更新日 2024年08月01日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：3分

AbstractDBObject スクリプトインクルードは、データベース内のレコードに基づくクラスに共通のメソッドを提供します。

このスクリプト インクルードを基底クラスとして使用して、独自のデータベース オブジェクト クラスを作成します。

## AbstractDBObject - isValid() {#ariaid-title2}

現在のデータベース レコードが有効かどうかを判定します。
「[IPService - グローバル](https://servicenow-prod.fluidtopics.net/e3huC18ZGitSqSiZ3zl43A#c_IPServiceAPI "IPService スクリプトインクルードは、IP サービスをカプセル化するメソッドを提供します。")」も参照してください。
{#r_ADBO-isValid__table_axq_zpc_pt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 1. パラメーター]

{#r_ADBO-isValid__table_axq_zpc_pt} {#r_ADBO-isValid__table_bxq_zpc_pt__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | データベース レコードが有効な場合は true を返し、そうでない場合は false を返します。 データベースレコードが有効かどうかを示すフラグです。 有効な値： * true：データベースレコードは有効です。 * false：データベースレコードは無効です。 {#r_ADBO-isValid__ul_sjw_bkv_hrb} |
[表 : 2. 返される内容]

{#r_ADBO-isValid__table_bxq_zpc_pt}  
次の例は、IP サービス \[cmdb_ip_service\] テーブルから IPService() クラスを使用して有効なインスタンスのリストを取得する方法を示しています。IPService クラスは、AbstractDBObject() クラスを拡張します。

    /**
     * IPService class Encapsulates the notion of an IP Service. Instances in which isValid() returns true have the 
     * following properties initialized: 
     *  sysID:       sys_id of this record
     *  port:        the TCP or UDP port used by the service
     *  protocol:    protocol used by the service ("UDP", "TCP", or "TCP/UDP")
     *  name:        short name or handle
     *  serviceName: long, descriptive English name
     *  creates:     table that this service creates entries in
     *  description: description
     */

    var result = [];
    // Array of sys_id's from the IP Service class which we want to get the abstract details
    var list = ['db9840e10ab3015500f5e3fe8f78da42', 'a1505ebc7782330099808d1168106179', 'abc05ebc7782330099808d1168106112'];

    // query for the records on the list
    var ipservice = new GlideRecord('cmdb_ip_service');
    ipservice.addQuery('sys_id', 'IN', list.toString());
    ipservice.query();
    while (ipservice.next()) {
        var ip = new IPService(ipservice); // IPService class extends AbstractDBObject class and this class 
        if (ip.isValid())      // check whether the record is valid or not
            result.push(ip);   // if valid get the properties for 
    }

    gs.info(JSON.stringify(result, null, 2));

出力:

    [
      {
        "valid": true,
        "sysID": "a1505ebc7782330099808d1168106179",
        "port": "8882",
        "protocol": "TCP",
        "name": "blkbry-uem-enroll",
        "serviceName": "Blackberry Enrollment Request",
        "creates": null,
        "description": null
      },
      {
        "valid": true,
        "sysID": "db9840e10ab3015500f5e3fe8f78da42",
        "port": "548",
        "protocol": "TCP",
        "name": "afp",
        "serviceName": "Apple File Protocol",
        "creates": null,
        "description": null
      }
    ]


