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?

More than 3 years have passed since last update.

ServiceNow - GlideQueryのバグと回避策

Posted at

GlideRecordの代わりにGlideQueryを利用してレコードを取得することもできる。
ただし、GlideQueryはArray.prototypeを利用するとエラーになる場合がある。

GlideQueryを使う直前にArray.prototypeがあると「Evaluator: org.mozilla.javascript.EcmaError: Cannot convert null to an object.」になる。

Array.prototype.MyFunction = function() { gs.print('Test'); }

var userCount = new GlideQuery('sys_user')
    .count();

ただし、同じGlideQuery文をArray.prototypeの前にも記述するとエラーは回避できる。

var userCount = new GlideQuery('sys_user')
    .count();

Array.prototype.MyFunction = function() { gs.print('Test'); }

var userCount = new GlideQuery('sys_user')
    .count();

異なるGlideQueryを記述するとエラーになるので注意。

以上

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?