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 タスク)
指定されたタスクの影響を受けるビジネスサービスを判別します。
| 名前 | タイプ | 説明 |
|---|---|---|
| タスク | 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