3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[ServiceNow] sys_idからどのテーブルにあるレコードか調べる

Posted at

きっかけ

エラー調査でトランザクションログを確認していて、対象のSysIDがどのテーブルのものかわからなかった

/sys.scripts.do?sys_id=xxxx..(対象のsys_id)&action=run_module

プラットフォーム

Paris

参考にしたURL

解決策

下記のスクリプトを実行

search_by_sysid
var target_id = "[検索対象のsys_id]";
 
var gr = new GlideRecord('sys_metadata');
gr.addQuery('sys_id', target_id);
gr.addActiveQuery();
gr.query();
while(gr.next()) {
    // このダブルチェックをしないと大量にゴミがログに吐かれるらしい
    if(gr.sys_id == target_id) {
        gs.log(" ID: " + gr.sys_id + " Name: " + gr.name + " Class: " + gr.sys_class_name);
        gs.log(gr.getRowCount());
    }
}

実行結果

*** Script: ID: xxxx..(対象のsys_id) Name: undefined Class: sys_app_module
*** Script: 1

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?