Read system properties with types and defaults
A small Script Include that reads system properties as numbers, booleans or lists with safe defaults, so code never hardcodes sys_ids or thresholds.
October 1, 2026 · #system-properties #configuration #best-practice
Configuration belongs in system properties, not in code. Properties come back as strings, though, so this helper converts them safely.
var Config = Class.create();
Config.prototype = {
initialize: function (prefix) {
this.prefix = prefix ? prefix + '.' : '';
},
str: function (name, fallback) {
var v = gs.getProperty(this.prefix + name, '');
return v === '' ? fallback : v;
},
num: function (name, fallback) {
var n = parseFloat(this.str(name, ''));
return isNaN(n) ? fallback : n;
},
bool: function (name, fallback) {
var v = this.str(name, '');
return v === '' ? fallback : v === 'true';
},
list: function (name) {
var v = this.str(name, '');
return v
? v
.split(',')
.map(function (s) {
return s.trim();
})
.filter(Boolean)
: [];
},
type: 'Config',
};
// Usage
// var cfg = new Config('x_acme_vendor');
// var days = cfg.num('auto_close_days', 14);
// var approverGroup = cfg.str('approver_group', '');
How it works
gs.getProperty(name, default)returns the default when the property doesn’t exist.- A prefix (your app scope) keeps property names consistent and short in code.
Gotchas
- Properties are cached; changes apply quickly, but don’t write to them in high-volume code.
- Give each property a description and read/write roles so admins know what it controls.
MIT licence. Provided as-is, without warranty. Test in a sub-production instance first.