0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ServiceNowで更新日が古いデータを用意する

Posted at

概要

  • 1週間以上何も更新されていないインシデントに対してスケジュールジョブによるバッチ処理でメールを通知する仕組みを導入したときに1週間以上何も更新されていないインシデントのデータを用意する必要があった。
  • 普通に更新したら現在日時で更新されてしまうからどうしたものかと思っていた。

解決案

サンプル

var gr = new GlideRecord('incident');
var sys_id = 'hogehoge' //実際はハッシュ値;
if (gr.get(sys_id)) {
    gr.autoSysFields(false);  // 更新者情報を変更しない
    gr.sys_updated_on = '2025-02-02 00:00:00';

    var success = gr.update();
    gs.info('Update success: ' + success);
}
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?