Service Now GlideRecord データベースの値ではなく、画面表示と同じ形式でデータを取得する getDisplayValue()
■ サンプル
var incidentGR = new GlideRecord('incident');
incidentGR.addQuery('priority', 1);
incidentGR.query();
while(incidentGR.next()){
gs.debug(incidentGR.number + '/' + incidentGR.priority);
}
■ getDisplayValue()を使う
var incidentGR = new GlideRecord('incident');
incidentGR.addQuery('priority', 1);
incidentGR.query();
while(incidentGR.next()){
gs.debug(incidentGR.number + '/' + incidentGR.priority.getDisplayValue());
}
Service Now Grid Record insert
■Service Now GlideRecord insert コードサンプル
var incidentGR = new GlideRecord('incident');
incidentGR.query();
incidentGR.newRecord();
incidentGR.short_description = 'TEST 123';
incidentGR.insert();
Service Now Scripts Backgroundでの実行結果
■ Service Now GlideRecord update コードサンプル
var incidentGR = new GlideRecord('incident');
incidentGR.addQuery('priority','1');
incidentGR.query();
while(incidentGR.next()){
incidentGR.priority = '3';
incidentGR.update();
}
■ Service Now GlideRecord delete コードサンプル
var incidentGR = new GlideRecord('incident');
incidentGR.addQuery('priority','1');
incidentGR.query();
while(incidentGR.next()){
incidentGR.deleteRecord();
}
Service Now GlideRecordとは
- Service NowのAPI
- サーバー側で動作
- データベース操作
- クエリー作成、レコード操作のシーケンスで動作する
サンプル
var incidentGR = new GlideRecord('incident');
incidentGR.addQuery('priority', 1);
incidentGR.query();
while(incidentGR.next()){
gs.debug(incidentGR.number);
}
Servicew Now Workflowsとは
- サーバー側で起動
- シリアルに実行(ワークフロー)
上記でSubmit押下で下記の画面が表示される
Activityを追加
各ActivityとWorkflowを接続していく
Service Now Script Includesとは
- サーバー側で動作
- JavaScriptのクラス、関数
- 再利用可能