Back to list
groeimetai

es5-compliance

by groeimetai

🤖 AI-powered ServiceNow development with 400+ MCP tools. Works with Claude, GPT, Gemini, Ollama & 75+ providers. Deploy widgets, manage incidents, automate workflows - all through natural language. Open-source Build Agent alternative.

42🍴 9📅 Jan 23, 2026

SKILL.md


name: es5-compliance description: This skill should be used when the user asks to "write a business rule", "create a script include", "write server-side code", "fix SyntaxError", "background script", "scheduled job", "workflow script", or any ServiceNow server-side JavaScript development. license: Apache-2.0 compatibility: Designed for Snow-Code and ServiceNow development metadata: author: groeimetai version: "1.0.0" category: servicenow tools:

  • snow_execute_script_with_output
  • snow_convert_es6_to_es5

ES5 Compliance for ServiceNow

ServiceNow runs on Mozilla Rhino engine which only supports ES5 JavaScript (2009 standard). All server-side scripts MUST use ES5 syntax.

Forbidden Syntax (WILL CAUSE SyntaxError)

ES6+ SyntaxES5 Alternative
const x = 5var x = 5
let items = []var items = []
() => {}function() {}
`Hello ${name}`'Hello ' + name
for (x of arr)for (var i = 0; i < arr.length; i++)
{a, b} = objvar a = obj.a; var b = obj.b;
[a, b] = arrvar a = arr[0]; var b = arr[1];
...spreadUse Array.prototype.slice.call()
class MyClass {}Use constructor functions
async/awaitUse GlideRecord callbacks
PromiseUse GlideRecord with callbacks

Common Patterns

Variable Declarations

// WRONG - ES6
const MAX_RETRIES = 3;
let currentUser = gs.getUser();

// CORRECT - ES5
var MAX_RETRIES = 3;
var currentUser = gs.getUser();

Functions

// WRONG - Arrow functions
var active = incidents.filter(inc => inc.active);
var process = () => { return 'done'; };

// CORRECT - ES5 functions
var active = [];
for (var i = 0; i < incidents.length; i++) {
  if (incidents[i].active) {
    active.push(incidents[i]);
  }
}
var process = function() { return 'done'; };

String Concatenation

// WRONG - Template literals
var message = `Incident ${number} assigned to ${user}`;

// CORRECT - String concatenation
var message = 'Incident ' + number + ' assigned to ' + user;

Loops

// WRONG - for...of
for (var item of items) {
  gs.info(item);
}

// CORRECT - Traditional for loop
for (var i = 0; i < items.length; i++) {
  gs.info(items[i]);
}

Default Parameters

// WRONG - Default parameters
function process(incident, priority = 3) {
  // ...
}

// CORRECT - Manual defaults
function process(incident, priority) {
  if (typeof priority === 'undefined') {
    priority = 3;
  }
  // ...
}

Automatic Validation

Before deploying any server-side script:

  1. Check for const/let declarations - convert to var
  2. Check for arrow functions => - convert to function()
  3. Check for template literals ` - convert to string concatenation
  4. Check for destructuring {a, b} - convert to explicit property access
  5. Check for for...of loops - convert to index-based loops

Exception: Client Scripts

Client-side scripts (Client Scripts, UI Policies) run in the browser and MAY support ES6+ depending on user's browser. However, for maximum compatibility, ES5 is still recommended.

Score

Total Score

75/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon