CIUtils - グローバル
CIUtils スクリプトインクルードは、構成アイテム (CI) を操作するためのメソッドを提供するユーティリティクラスです。
デフォルトでは、CI 関係を走査するときにシステムで使用される最大深度は 10 です。この値を上書きするには、glide.relationship.max_depth プロパティを変更します。
返されるアイテムの最大数は 1000 です。この値を上書きするには、glide.relationship.threshold プロパティを変更します。
CIUtils クラスはサーバー側のスクリプトで使用できます。
CIUtils - servicesAffectedByCI(文字列 CI_sys_id)
特定の構成アイテム (CI) の影響を受けるビジネスサービスを判断します。
| 名前 | タイプ | 説明 |
|---|---|---|
| CI_sys_id | 文字列 | チェックする構成アイテム (cmdb_ci) の sys_id です。 |
| タイプ | 説明 |
|---|---|
| アレイ | 指定されたアイテムの下流にある (または影響を受ける) cmdb_ci レコードの sys_id 値のアレイ |
この例は、名前が lnux100 の CI アイテムの影響を受けるサービスの名前を表示します。
var CIUtil = new CIUtils();
//get a server record
var server = new GlideRecord("cmdb_ci_server");
server.addQuery("name", "lnux100");
server.query();
if (server.next()) {
//get the affected services, array of ids
var serviceIds = CIUtil.servicesAffectedByCI(server.getUniqueValue());
for (var i=0; i < serviceIds.length; i++) {
//get the service record
var service = new GlideRecord("cmdb_ci_service");
service.get(serviceIds[i]);
gs.print(service.getDisplayValue());
}
}
出力:
Client Services
IT Services
Bond TradingCIUtils - servicesAffectedByTask(GlideRecord task)
指定されたタスクの影響を受けるビジネスサービスを判断します。
| 名前 | タイプ | 説明 |
|---|---|---|
| task | GlideRecord | タスク GlideRecord (インシデント、change_request、問題など)。 |
| タイプ | 説明 |
|---|---|
| アレイ | タスクの cmdb_ci フィールドによって参照される構成アイテムの下流の (または構成アイテムの影響を受ける) CI のsys_id値のリスト。 |
この例は、 インシデント INC00050 の影響を受けるサービスの名前を示しています 。
var CIUtil = new CIUtils();
//get an incident record
var inc = new GlideRecord("incident");
inc.addQuery("number", "INC00050");
inc.query();
if (inc.next()) {
//get the affected services, array of ids
var serviceIds = CIUtil.servicesAffectedByTask(inc);
for (var i=0; i < serviceIds.length; i++) {
//get the service record
var service = new GlideRecord("cmdb_ci_service");
service.get(serviceIds[i]);
gs.print(service.getDisplayValue());
}
}
出力:
IT Services
Email
Windows Mobile
Electronic Messaging
Outlook Web Access (OWA)
Blackberry