ServiceNow 中需要经常更新的应用程序设置的最佳存储位置在哪里

Where is the best place to store an application setting that needs to be updated frequently in ServiceNow

我有一个预定的脚本执行需要在 运行 秒之间保留一个值。它随每个 运行 更新。在我遇到这个之前,使用 gs.setProperty 似乎是很自然的地方:

Care should be taken when setting system properties (sys_properties) using this method as it causes a system-wide cache flush. Each flush can cause system degradation while the caches rebuild. If a value must be updated often, it should not be stored as a system property. In general, you should only place values in the sys_properties table that do not frequently change.

创建一个单独的 table 来存储单个标量值似乎有些矫枉过正。有没有更好的地方存放它?

如果您需要,您可以在实例中设置首选项。另一个地方可能是事件 table。使用 parm1 或 parm2 中的数据记录事件,并在接下来 运行 查询最近的事件。

我会避免制作 table,因为这对某些客户有成本影响。我同意 sys_properties.

var encrypter = new GlideEncrypter();
var encrypted = encrypter.encrypt('Super Secret Phrase');
gs.info('encrypted: ' + encrypted);
var decrypted = encrypter.decrypt(encrypted);
gs.info('decrypted: ' + decrypted);
/**
*** Script: encrypted: g/bXLJHa7xNRMKZEo5q/YtLMEdse36ED
*** Script: decrypted: Super Secret Phrase
*/

这样只有管理员才能真正读取这些数据。另外,如果我没记错的话,系统事件 table 会在 7 天后清除。您可以让作业在事件存入内存后立即将其删除。