snow-flow 3.6.0 → 3.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,1064 +1,314 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLAUDE_MD_TEMPLATE = void 0;
|
|
4
|
-
exports.CLAUDE_MD_TEMPLATE = `# Snow-Flow
|
|
3
|
+
exports.CLAUDE_MD_TEMPLATE_VERSION = exports.CLAUDE_MD_TEMPLATE = void 0;
|
|
4
|
+
exports.CLAUDE_MD_TEMPLATE = `# Snow-Flow ServiceNow Development Framework
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## 🚨 ABSOLUTE RULES - NO EXCEPTIONS
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
3. [ServiceNow Development Standards](#servicenow-development-standards)
|
|
12
|
-
4. [MCP Server Capabilities](#mcp-server-capabilities)
|
|
13
|
-
5. [Debugging Best Practices](#debugging-best-practices)
|
|
14
|
-
6. [Command Reference](#command-reference)
|
|
15
|
-
7. [Workflow Guidelines](#workflow-guidelines)
|
|
8
|
+
### Rule #1: NO MOCK DATA - EVERYTHING REAL & COMPLETE
|
|
9
|
+
**FORBIDDEN:** Mock data, placeholders, TODOs, stub implementations, test values, simulations, "this would normally...", partial implementations.
|
|
10
|
+
**REQUIRED:** Complete, production-ready, fully functional code. Take time to implement EVERYTHING properly. Real integrations, comprehensive error handling, full validation.
|
|
16
11
|
|
|
17
|
-
|
|
12
|
+
### Rule #2: ES5 ONLY - ServiceNow Rhino Engine
|
|
13
|
+
**NEVER USE:** const/let, arrow functions =>, template literals \`\${}\`, destructuring, for...of, default parameters, classes
|
|
14
|
+
**ALWAYS USE:** var, function(){}, string concatenation +, traditional for loops, typeof checks
|
|
18
15
|
|
|
19
|
-
###
|
|
16
|
+
### Rule #3: VERIFY FIRST - Never Assume
|
|
17
|
+
Test before claiming broken. Check resources exist. Validate configurations. Evidence-based fixes only.
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
- "Widget skips questions" → \`snow_pull_artifact\`
|
|
23
|
-
- "Form doesn't submit properly" → \`snow_pull_artifact\`
|
|
24
|
-
- "Data not displaying" → \`snow_pull_artifact\`
|
|
25
|
-
- "Button doesn't work" → \`snow_pull_artifact\`
|
|
26
|
-
- "Debug this widget" → \`snow_pull_artifact\`
|
|
27
|
-
- "Fix widget issue" → \`snow_pull_artifact\`
|
|
19
|
+
## 📋 MCP SERVERS & TOOLS (18 Servers, 200+ Tools)
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
## Core Philosophy
|
|
32
|
-
|
|
33
|
-
### The Prime Directive: Verify, Don't Assume
|
|
34
|
-
|
|
35
|
-
Snow-Flow operates on evidence-based development. Never make assumptions about what exists or doesn't exist in a ServiceNow environment. Every environment is unique with custom tables, fields, integrations, and configurations that you cannot predict.
|
|
36
|
-
|
|
37
|
-
**Cardinal Rules:**
|
|
38
|
-
1. If code references something, it probably exists
|
|
39
|
-
2. Test before declaring something broken
|
|
40
|
-
3. Verify before modifying
|
|
41
|
-
4. Fix only what's confirmed broken
|
|
42
|
-
5. Respect existing configurations
|
|
43
|
-
|
|
44
|
-
### The Verification-First Approach
|
|
45
|
-
|
|
46
|
-
\`\`\`javascript
|
|
47
|
-
// Before claiming anything doesn't work or exist:
|
|
48
|
-
// Step 1: Test the actual implementation
|
|
49
|
-
const verify = await snow_execute_script_with_output({
|
|
50
|
-
script: \`/* Test the exact code or resource */\`
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Step 2: Check if resources exist
|
|
54
|
-
const tableCheck = await snow_discover_table_fields({
|
|
55
|
-
table_name: 'potentially_custom_table'
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// Step 3: Validate configurations
|
|
59
|
-
const propertyCheck = await snow_property_manager({
|
|
60
|
-
action: 'get',
|
|
61
|
-
name: 'system.property'
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Step 4: Only then make informed decisions
|
|
21
|
+
### 1. **servicenow-local-development** 🔧 Widget/Artifact Sync
|
|
65
22
|
\`\`\`
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
If a user says any of these:
|
|
72
|
-
- "I've updated the widget in ServiceNow"
|
|
73
|
-
- "I made some changes to the flow"
|
|
74
|
-
- "I modified the script"
|
|
75
|
-
- "I adjusted the configuration"
|
|
76
|
-
- "Ik heb het zelf aangepast" (Dutch: I adjusted it myself)
|
|
77
|
-
|
|
78
|
-
**YOU MUST:**
|
|
79
|
-
|
|
80
|
-
1. **Immediately fetch the current version from ServiceNow:**
|
|
81
|
-
\`\`\`javascript
|
|
82
|
-
// For any artifact the user has modified
|
|
83
|
-
const currentVersion = await snow_query_table({
|
|
84
|
-
table: 'artifact_table_name',
|
|
85
|
-
query: \`sys_id=\${artifact_sys_id}\`,
|
|
86
|
-
fields: ['*'], // Get all fields
|
|
87
|
-
limit: 1
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// Or for widgets specifically
|
|
91
|
-
const widgetData = await snow_query_table({
|
|
92
|
-
table: 'sp_widget',
|
|
93
|
-
query: \`sys_id=\${widget_sys_id}\`,
|
|
94
|
-
fields: ['name', 'template', 'client_script', 'script', 'css', 'option_schema'],
|
|
95
|
-
limit: 1
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// Or use snow_get_by_sysid for comprehensive retrieval
|
|
99
|
-
const artifact = await snow_get_by_sysid({
|
|
100
|
-
table: 'table_name',
|
|
101
|
-
sys_id: 'the_sys_id'
|
|
102
|
-
});
|
|
23
|
+
snow_pull_artifact - Pull ANY artifact to local files for native editing
|
|
24
|
+
snow_push_artifact - Push local changes back to ServiceNow
|
|
25
|
+
snow_cleanup_artifacts - Clean local artifact cache
|
|
26
|
+
snow_get_sync_status - Check artifact sync status
|
|
27
|
+
snow_list_local_artifacts - List all pulled artifacts
|
|
103
28
|
\`\`\`
|
|
104
29
|
|
|
105
|
-
2. **
|
|
106
|
-
- Review what they changed
|
|
107
|
-
- Understand their intent
|
|
108
|
-
- Preserve their modifications
|
|
109
|
-
|
|
110
|
-
3. **Build upon their changes:**
|
|
111
|
-
- Don't overwrite their work
|
|
112
|
-
- Integrate new features with their modifications
|
|
113
|
-
- Maintain their code style and patterns
|
|
114
|
-
|
|
115
|
-
4. **Inform the user:**
|
|
116
|
-
- Acknowledge that you've fetched their latest changes
|
|
117
|
-
- Summarize what modifications you found
|
|
118
|
-
- Explain how you'll build upon their work
|
|
119
|
-
|
|
120
|
-
**Example Workflow:**
|
|
121
|
-
\`\`\`javascript
|
|
122
|
-
// User: "I've updated the widget to add a loading spinner"
|
|
123
|
-
// Snow-Flow response:
|
|
124
|
-
|
|
125
|
-
// 1. Fetch current version
|
|
126
|
-
const widget = await snow_query_table({
|
|
127
|
-
table: 'sp_widget',
|
|
128
|
-
query: \`sys_id=\${widgetSysId}\`,
|
|
129
|
-
fields: ['*'],
|
|
130
|
-
limit: 1
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// 2. Analyze changes
|
|
134
|
-
console.log("✅ Fetched your latest widget version from ServiceNow");
|
|
135
|
-
console.log("📝 I see you've added a loading spinner in the template");
|
|
136
|
-
|
|
137
|
-
// 3. Work with the updated version
|
|
138
|
-
// ... make additional changes based on user's modifications ...
|
|
30
|
+
### 2. **servicenow-deployment** 🚀 Complete Deployment System
|
|
139
31
|
\`\`\`
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
|
|
148
|
-
## Fundamental Rules
|
|
149
|
-
|
|
150
|
-
### Rule 1: 🚨 ES5 JavaScript ONLY in ServiceNow - NO EXCEPTIONS!
|
|
151
|
-
|
|
152
|
-
**⚠️ CRITICAL WARNING: ServiceNow uses Rhino engine - ES6/ES7/ES8+ WILL FAIL!**
|
|
153
|
-
|
|
154
|
-
ServiceNow's server-side JavaScript runs on Mozilla Rhino which **ONLY supports ES5 (2009)**. Any modern JavaScript syntax will cause **RUNTIME ERRORS**.
|
|
155
|
-
|
|
156
|
-
**❌ THESE WILL CRASH SERVICENOW (DO NOT USE):**
|
|
157
|
-
\`\`\`javascript
|
|
158
|
-
// ❌ ES6+ features that BREAK ServiceNow:
|
|
159
|
-
const data = []; // SyntaxError: missing ; after for-loop initializer
|
|
160
|
-
let items = []; // SyntaxError: missing ; after for-loop initializer
|
|
161
|
-
const fn = () => {}; // SyntaxError: syntax error
|
|
162
|
-
var msg = \`Hello \${name}\`; // SyntaxError: syntax error
|
|
163
|
-
for (let item of items){} // SyntaxError: missing ; after for-loop initializer
|
|
164
|
-
var {name, id} = user; // SyntaxError: destructuring declaration not supported
|
|
165
|
-
array.forEach(x => {}); // SyntaxError: syntax error
|
|
166
|
-
array.map(x => x.id); // SyntaxError: syntax error
|
|
167
|
-
function test(param = 'default') {} // SyntaxError: syntax error
|
|
168
|
-
class MyClass {} // SyntaxError: missing ; after for-loop initializer
|
|
32
|
+
snow_deploy - Create NEW artifacts (widgets, flows, scripts, pages)
|
|
33
|
+
snow_update - UPDATE existing artifacts directly
|
|
34
|
+
snow_validate_deployment - Validate before deploy
|
|
35
|
+
snow_rollback_deployment - Rollback failed deployments
|
|
36
|
+
snow_preview_widget - Preview widget rendering
|
|
37
|
+
snow_widget_test - Test widget functionality
|
|
38
|
+
snow_deployment_history - View deployment history
|
|
39
|
+
snow_check_widget_coherence - Validate HTML/Client/Server communication
|
|
169
40
|
\`\`\`
|
|
170
41
|
|
|
171
|
-
|
|
172
|
-
\`\`\`javascript
|
|
173
|
-
// ✅ ES5 compatible code that WORKS in ServiceNow:
|
|
174
|
-
var data = [];
|
|
175
|
-
var items = [];
|
|
176
|
-
function fn() { return 'result'; }
|
|
177
|
-
var msg = 'Hello ' + name;
|
|
178
|
-
for (var i = 0; i < items.length; i++) {
|
|
179
|
-
var item = items[i];
|
|
180
|
-
}
|
|
181
|
-
var name = user.name;
|
|
182
|
-
var id = user.id;
|
|
183
|
-
for (var j = 0; j < array.length; j++) {
|
|
184
|
-
// Process array[j]
|
|
185
|
-
}
|
|
186
|
-
function test(param) {
|
|
187
|
-
if (typeof param === 'undefined') param = 'default';
|
|
188
|
-
}
|
|
42
|
+
### 3. **servicenow-operations** 📊 Core Operations
|
|
189
43
|
\`\`\`
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
### Rule 2: Background Scripts for Verification Only (Not Widget Updates!)
|
|
201
|
-
|
|
202
|
-
**CRITICAL DISTINCTION:**
|
|
203
|
-
- ✅ Use background scripts for TESTING and VERIFICATION
|
|
204
|
-
- ❌ Do NOT use background scripts to UPDATE widget fields
|
|
205
|
-
- ✅ Use \`snow_update\` to directly modify widget records
|
|
206
|
-
- ❌ Do NOT try to import server scripts into client scripts via background scripts
|
|
207
|
-
|
|
208
|
-
**🚨 ES5 ENFORCEMENT FOR BACKGROUND SCRIPTS:**
|
|
209
|
-
Background scripts run on ServiceNow's server-side Rhino engine. **EVERY background script MUST be ES5-only or it will fail.**
|
|
210
|
-
|
|
211
|
-
**Quick ES5 Validation Checklist:**
|
|
212
|
-
- [ ] No \`const\` or \`let\` (only \`var\`)
|
|
213
|
-
- [ ] No arrow functions \`() => {}\` (only \`function() {}\`)
|
|
214
|
-
- [ ] No template literals \`\` \`\${var}\` \`\` (only string concatenation)
|
|
215
|
-
- [ ] No destructuring \`{a, b} = obj\` (only explicit \`obj.a\`)
|
|
216
|
-
- [ ] No \`for...of\` loops (only traditional \`for\` loops)
|
|
217
|
-
- [ ] No default parameters (use \`typeof\` checks)
|
|
218
|
-
- [ ] No modern array methods with arrows (use traditional functions)
|
|
219
|
-
|
|
220
|
-
Background scripts are excellent for verification and debugging, but widget updates must go through proper MCP tools.
|
|
221
|
-
|
|
222
|
-
**NEW: Auto-Confirm Mode for Background Scripts (v3.4.10+)**
|
|
223
|
-
You can now skip the human-in-the-loop confirmation for trusted scripts:
|
|
224
|
-
|
|
225
|
-
\`\`\`javascript
|
|
226
|
-
// Standard mode - requires user confirmation (ES5 ONLY!)
|
|
227
|
-
snow_execute_background_script({
|
|
228
|
-
script: "var gr = new GlideRecord('incident'); gr.query();", // ✅ ES5 syntax
|
|
229
|
-
description: "Query incidents",
|
|
230
|
-
allowDataModification: false
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
// Auto-confirm mode - executes immediately ⚠️ USE WITH CAUTION!
|
|
234
|
-
snow_execute_background_script({
|
|
235
|
-
script: "var gr = new GlideRecord('incident'); gr.query();", // ✅ ES5 syntax
|
|
236
|
-
description: "Query incidents",
|
|
237
|
-
allowDataModification: false,
|
|
238
|
-
autoConfirm: true // ⚠️ Bypasses user confirmation!
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
// ❌ WRONG - This will FAIL in ServiceNow:
|
|
242
|
-
// script: "const gr = new GlideRecord('incident'); gr.query();", // SyntaxError!
|
|
243
|
-
// script: "incidents.forEach(i => console.log(i.number));", // SyntaxError!
|
|
44
|
+
snow_query_table - Universal table query with pagination
|
|
45
|
+
snow_query_incidents - Query and analyze incidents
|
|
46
|
+
snow_analyze_incident - AI-powered incident analysis
|
|
47
|
+
snow_auto_resolve_incident - Automated resolution
|
|
48
|
+
snow_cmdb_search - Configuration database search
|
|
49
|
+
snow_user_lookup - Find users and groups
|
|
50
|
+
snow_operational_metrics - Performance metrics
|
|
51
|
+
snow_knowledge_search - Search knowledge base
|
|
52
|
+
snow_catalog_item_manager - Manage service catalog
|
|
244
53
|
\`\`\`
|
|
245
54
|
|
|
246
|
-
|
|
247
|
-
Before using any background script tool, validate your script is ES5-only:
|
|
248
|
-
- No \`const\`/\`let\` (use \`var\`)
|
|
249
|
-
- No arrow functions (use \`function()\`)
|
|
250
|
-
- No template literals (use string concatenation)
|
|
251
|
-
- No destructuring (use explicit property access)
|
|
252
|
-
|
|
253
|
-
**⚠️ Security Warning:**
|
|
254
|
-
- Only use \`autoConfirm: true\` for verified, safe scripts
|
|
255
|
-
- High-risk operations will still be logged
|
|
256
|
-
- All auto-executions are tracked with audit IDs
|
|
257
|
-
- Default behavior (without autoConfirm) remains unchanged
|
|
258
|
-
|
|
259
|
-
## 🚨 CRITICAL: Common ES5 Mistakes That Break ServiceNow
|
|
260
|
-
|
|
261
|
-
ServiceNow developers frequently use modern JavaScript that fails on the Rhino engine. Here are the most common mistakes:
|
|
262
|
-
|
|
263
|
-
### 🔥 Top ES5 Violations (Fix These Immediately!)
|
|
264
|
-
|
|
265
|
-
**1. Arrow Functions with Array Methods**
|
|
266
|
-
\`\`\`javascript
|
|
267
|
-
// ❌ BREAKS ServiceNow:
|
|
268
|
-
var activeIncidents = incidents.filter(inc => inc.active);
|
|
269
|
-
var numbers = activeIncidents.map(inc => inc.number);
|
|
270
|
-
|
|
271
|
-
// ✅ WORKS in ServiceNow:
|
|
272
|
-
var activeIncidents = [];
|
|
273
|
-
for (var i = 0; i < incidents.length; i++) {
|
|
274
|
-
if (incidents[i].active) {
|
|
275
|
-
activeIncidents.push(incidents[i]);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
var numbers = [];
|
|
279
|
-
for (var j = 0; j < activeIncidents.length; j++) {
|
|
280
|
-
numbers.push(activeIncidents[j].number);
|
|
281
|
-
}
|
|
55
|
+
### 4. **servicenow-automation** ⚙️ Scripts & Automation
|
|
282
56
|
\`\`\`
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
57
|
+
snow_execute_background_script - Run ES5 scripts (autoConfirm available)
|
|
58
|
+
snow_execute_script_with_output - Execute with output capture
|
|
59
|
+
snow_execute_script_sync - Synchronous execution
|
|
60
|
+
snow_get_script_output - Retrieve script results
|
|
61
|
+
snow_schedule_job - Create scheduled jobs
|
|
62
|
+
snow_create_event - Trigger system events
|
|
63
|
+
snow_get_logs - Access system logs
|
|
64
|
+
snow_test_rest_connection - Test REST endpoints
|
|
65
|
+
snow_trace_execution - Performance tracing
|
|
291
66
|
\`\`\`
|
|
292
67
|
|
|
293
|
-
|
|
294
|
-
\`\`\`javascript
|
|
295
|
-
// ❌ BREAKS ServiceNow:
|
|
296
|
-
const MAX_RETRIES = 3;
|
|
297
|
-
let currentUser = gs.getUser();
|
|
298
|
-
|
|
299
|
-
// ✅ WORKS in ServiceNow:
|
|
300
|
-
var MAX_RETRIES = 3;
|
|
301
|
-
var currentUser = gs.getUser();
|
|
68
|
+
### 5. **servicenow-platform-development** 🏗️ Development Artifacts
|
|
302
69
|
\`\`\`
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
var name = user.name;
|
|
312
|
-
var email = user.email;
|
|
313
|
-
var department = user.department;
|
|
314
|
-
var id = incident.sys_id;
|
|
315
|
-
var desc = incident.short_description;
|
|
70
|
+
snow_create_ui_page - Create UI pages
|
|
71
|
+
snow_create_script_include - Reusable scripts
|
|
72
|
+
snow_create_business_rule - Business rules
|
|
73
|
+
snow_create_client_script - Client-side scripts
|
|
74
|
+
snow_create_ui_policy - UI policies
|
|
75
|
+
snow_create_ui_action - UI actions
|
|
76
|
+
snow_create_acl - Access controls
|
|
77
|
+
snow_create_ui_macro - UI macros
|
|
316
78
|
\`\`\`
|
|
317
79
|
|
|
318
|
-
|
|
319
|
-
\`\`\`javascript
|
|
320
|
-
// ❌ BREAKS ServiceNow:
|
|
321
|
-
for (let incident of incidents) {
|
|
322
|
-
gs.info('Processing: ' + incident.number);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// ✅ WORKS in ServiceNow:
|
|
326
|
-
for (var i = 0; i < incidents.length; i++) {
|
|
327
|
-
gs.info('Processing: ' + incidents[i].number);
|
|
328
|
-
}
|
|
80
|
+
### 6. **servicenow-integration** 🔌 Integrations
|
|
329
81
|
\`\`\`
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
// ✅ WORKS in ServiceNow:
|
|
339
|
-
function processIncident(incident, priority, assignee) {
|
|
340
|
-
if (typeof priority === 'undefined') priority = 3;
|
|
341
|
-
if (typeof assignee === 'undefined') assignee = 'unassigned';
|
|
342
|
-
// Process incident
|
|
343
|
-
}
|
|
82
|
+
snow_create_rest_message - REST integrations
|
|
83
|
+
snow_create_soap_message - SOAP integrations
|
|
84
|
+
snow_create_transform_map - Data transformation
|
|
85
|
+
snow_create_import_set - Import management
|
|
86
|
+
snow_test_web_service - Test services
|
|
87
|
+
snow_configure_email - Email configuration
|
|
88
|
+
snow_create_data_source - Data sources
|
|
344
89
|
\`\`\`
|
|
345
90
|
|
|
346
|
-
###
|
|
347
|
-
| Modern (ES6+) | ES5 Equivalent |
|
|
348
|
-
|---------------|----------------|
|
|
349
|
-
| \`const x = 5;\` | \`var x = 5;\` |
|
|
350
|
-
| \`let items = [];\` | \`var items = [];\` |
|
|
351
|
-
| \`() => {}\` | \`function() {}\` |
|
|
352
|
-
| \`\` \`Hello \${name}\` \`\` | \`'Hello ' + name\` |
|
|
353
|
-
| \`{a, b} = obj\` | \`var a = obj.a; var b = obj.b;\` |
|
|
354
|
-
| \`for (item of items)\` | \`for (var i = 0; i < items.length; i++)\` |
|
|
355
|
-
| \`func(x = 'default')\` | \`if (typeof x === 'undefined') x = 'default';\` |
|
|
356
|
-
| \`arr.map(x => x.id)\` | \`arr.map(function(x) { return x.id; })\` |
|
|
357
|
-
|
|
358
|
-
\`\`\`javascript
|
|
359
|
-
// Universal verification pattern
|
|
360
|
-
const verify = await snow_execute_script_with_output({
|
|
361
|
-
script: \`
|
|
362
|
-
gs.info('=== VERIFICATION TEST ===');
|
|
363
|
-
|
|
364
|
-
// Test table existence
|
|
365
|
-
var table = new GlideRecord('table_name');
|
|
366
|
-
gs.info('Table valid: ' + table.isValid());
|
|
367
|
-
|
|
368
|
-
// Test property existence
|
|
369
|
-
var prop = gs.getProperty('property.name');
|
|
370
|
-
gs.info('Property: ' + (prop || 'NOT SET'));
|
|
371
|
-
|
|
372
|
-
// Test actual code
|
|
373
|
-
try {
|
|
374
|
-
// User's code here
|
|
375
|
-
gs.info('SUCCESS');
|
|
376
|
-
} catch(e) {
|
|
377
|
-
gs.error('ERROR: ' + e.message);
|
|
378
|
-
}
|
|
379
|
-
\`
|
|
380
|
-
});
|
|
91
|
+
### 7. **servicenow-system-properties** ⚙️ Properties
|
|
381
92
|
\`\`\`
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
**Server Script Must:**
|
|
390
|
-
- Initialize all \`data\` properties that HTML will reference
|
|
391
|
-
- Handle every \`input.action\` that client sends
|
|
392
|
-
- Return data in the format client expects
|
|
393
|
-
|
|
394
|
-
**Client Script Must:**
|
|
395
|
-
- Implement every method that HTML calls via \`ng-click\`
|
|
396
|
-
- Use \`c.server.get({action: 'name'})\` for server communication
|
|
397
|
-
- Update \`c.data\` when server responds
|
|
398
|
-
|
|
399
|
-
**HTML Template Must:**
|
|
400
|
-
- Only reference \`data\` properties that server provides
|
|
401
|
-
- Only call methods that client implements
|
|
402
|
-
- Use correct Angular directives and bindings
|
|
403
|
-
|
|
404
|
-
**Critical Communication Points:**
|
|
405
|
-
|
|
406
|
-
1. **Server → Client Data Flow**
|
|
407
|
-
- Server sets \`data.property\`
|
|
408
|
-
- Client receives via \`c.data.property\`
|
|
409
|
-
- HTML displays with \`{{data.property}}\`
|
|
410
|
-
|
|
411
|
-
2. **Client → Server Requests**
|
|
412
|
-
- Client sends \`c.server.get({action: 'name'})\`
|
|
413
|
-
- Server receives via \`input.action\`
|
|
414
|
-
- Server processes and returns updated \`data\`
|
|
415
|
-
|
|
416
|
-
3. **HTML → Client Method Calls**
|
|
417
|
-
- HTML has \`ng-click="methodName()"\`
|
|
418
|
-
- Client must have \`$scope.methodName = function()\`
|
|
419
|
-
- Method typically calls server with \`c.server.get()\`
|
|
420
|
-
|
|
421
|
-
**Common Failures to Avoid:**
|
|
422
|
-
- Action name mismatches between client and server
|
|
423
|
-
- Method name mismatches between HTML and client
|
|
424
|
-
- Property name mismatches between server and HTML
|
|
425
|
-
- Missing handlers for client requests
|
|
426
|
-
- Orphaned data properties or methods
|
|
427
|
-
|
|
428
|
-
**Coherence Validation Checklist:**
|
|
429
|
-
- [ ] Every \`data.property\` in server is used in HTML/client
|
|
430
|
-
- [ ] Every \`ng-click\` in HTML has matching \`$scope.method\` in client
|
|
431
|
-
- [ ] Every \`c.server.get({action})\` in client has matching \`if(input.action)\` in server
|
|
432
|
-
- [ ] Data flows correctly: Server → HTML → Client → Server
|
|
433
|
-
- [ ] No orphaned methods or unused data properties
|
|
434
|
-
|
|
435
|
-
### Rule 4: Use Local Sync for Widget Debugging - NOT snow_query_table!
|
|
436
|
-
|
|
437
|
-
**CRITICAL: When debugging widgets, ALWAYS use \`snow_pull_artifact\` first!**
|
|
438
|
-
|
|
439
|
-
\`\`\`javascript
|
|
440
|
-
// ✅ CORRECT - Use Local Sync for widget debugging
|
|
441
|
-
snow_pull_artifact({
|
|
442
|
-
sys_id: 'widget_sys_id',
|
|
443
|
-
table: 'sp_widget'
|
|
444
|
-
});
|
|
445
|
-
// Now use Claude Code native search, multi-file edit, etc.
|
|
446
|
-
|
|
447
|
-
// ❌ WRONG - Don't use snow_query_table for debugging widgets
|
|
448
|
-
snow_query_table({
|
|
449
|
-
table: 'sp_widget',
|
|
450
|
-
query: 'sys_id=...',
|
|
451
|
-
fields: ['template', 'script', 'client_script']
|
|
452
|
-
});
|
|
453
|
-
// This hits token limits and can't use native tools!
|
|
93
|
+
snow_property_get - Get property value
|
|
94
|
+
snow_property_set - Set property value
|
|
95
|
+
snow_property_list - List by pattern
|
|
96
|
+
snow_property_bulk_update - Bulk operations
|
|
97
|
+
snow_property_export/import - Export/Import JSON
|
|
98
|
+
snow_property_validate - Validate properties
|
|
454
99
|
\`\`\`
|
|
455
100
|
|
|
456
|
-
|
|
457
|
-
- **No token limits** - Handle widgets of ANY size
|
|
458
|
-
- **Native search** - Find issues across all files instantly
|
|
459
|
-
- **Multi-file view** - See relationships between components
|
|
460
|
-
- **Better debugging** - Trace data flow, find missing methods
|
|
461
|
-
- **Coherence checking** - Validate all parts work together
|
|
462
|
-
|
|
463
|
-
**Widget Debugging Workflow:**
|
|
464
|
-
1. User reports issue → \`snow_pull_artifact\`
|
|
465
|
-
2. Search for error patterns across files
|
|
466
|
-
3. Fix using multi-file edit
|
|
467
|
-
4. Validate coherence → \`snow_validate_artifact_coherence\`
|
|
468
|
-
5. Push fixes back → \`snow_push_artifact\`
|
|
469
|
-
|
|
470
|
-
**IMPORTANT: Use Local Sync Instead of Query for Large Widgets**
|
|
471
|
-
|
|
472
|
-
When you see "exceeds maximum allowed tokens" errors, don't try to fetch fields separately with \`snow_query_table\`. Use Local Sync instead:
|
|
473
|
-
|
|
474
|
-
\`\`\`javascript
|
|
475
|
-
// ❌ WRONG - Don't do this when debugging:
|
|
476
|
-
snow_query_table({ table: 'sp_widget', fields: ['name'] });
|
|
477
|
-
snow_query_table({ table: 'sp_widget', fields: ['script'] });
|
|
478
|
-
snow_query_table({ table: 'sp_widget', fields: ['client_script'] });
|
|
479
|
-
// This is inefficient and can't use native tools!
|
|
480
|
-
|
|
481
|
-
// ✅ CORRECT - Use Local Sync:
|
|
482
|
-
snow_pull_artifact({
|
|
483
|
-
sys_id: '01d01d6983176a502a7ea130ceaad376'
|
|
484
|
-
});
|
|
485
|
-
// All files available locally with NO token limits!
|
|
101
|
+
### 8. **servicenow-update-set** 📦 Change Management
|
|
486
102
|
\`\`\`
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
-
|
|
490
|
-
-
|
|
491
|
-
-
|
|
492
|
-
-
|
|
493
|
-
|
|
494
|
-
### Rule 5: Evidence-Based Debugging
|
|
495
|
-
|
|
496
|
-
Follow this systematic approach for all debugging:
|
|
497
|
-
|
|
498
|
-
1. **Reproduce** - Run the exact failing code
|
|
499
|
-
2. **Inventory** - List all dependencies
|
|
500
|
-
3. **Verify** - Test each dependency exists
|
|
501
|
-
4. **Fix** - Correct only confirmed issues
|
|
502
|
-
|
|
503
|
-
**Fix only:**
|
|
504
|
-
- ✅ Confirmed syntax errors
|
|
505
|
-
- ✅ Verified null references
|
|
506
|
-
- ✅ Missing dependencies (after verification)
|
|
507
|
-
- ✅ Real type mismatches
|
|
508
|
-
|
|
509
|
-
**Never change:**
|
|
510
|
-
- ❌ Unverified resources
|
|
511
|
-
- ❌ Configurations that "seem wrong"
|
|
512
|
-
- ❌ APIs you haven't tested
|
|
513
|
-
- ❌ Working code that could be "better"
|
|
514
|
-
|
|
515
|
-
## ServiceNow Development Standards
|
|
516
|
-
|
|
517
|
-
### Table Operations
|
|
518
|
-
- Always verify table existence before operations
|
|
519
|
-
- Use proper field types and references
|
|
520
|
-
- Check for ACLs and permissions
|
|
521
|
-
- Handle large datasets with pagination
|
|
522
|
-
|
|
523
|
-
### Script Development
|
|
524
|
-
- Use Script Includes for reusable code
|
|
525
|
-
- Implement proper error handling
|
|
526
|
-
- Add meaningful logging with gs.info/warn/error
|
|
527
|
-
- Test in scoped applications when applicable
|
|
528
|
-
- **NEVER use background scripts to update widget fields - use \`snow_update\` instead**
|
|
529
|
-
|
|
530
|
-
### Widget Development
|
|
531
|
-
|
|
532
|
-
**CRITICAL: Direct Widget Updates (Not Background Scripts!)**
|
|
533
|
-
- Use \`snow_update({ type: 'widget', identifier: 'widget_name', config: { /* fields to update */ }})\`
|
|
534
|
-
- Updates widget fields DIRECTLY on the widget record
|
|
535
|
-
- Do NOT use background scripts to update widget fields
|
|
536
|
-
- Do NOT try to import server scripts into client scripts
|
|
537
|
-
|
|
538
|
-
**Widget Coherence Requirements:**
|
|
539
|
-
- Ensure HTML/Client/Server scripts communicate properly
|
|
540
|
-
- Use Angular providers correctly
|
|
541
|
-
- Implement proper data binding
|
|
542
|
-
- Test across different themes and portals
|
|
543
|
-
|
|
544
|
-
**Creating New Widgets:**
|
|
545
|
-
\`\`\`javascript
|
|
546
|
-
snow_deploy({
|
|
547
|
-
type: 'widget',
|
|
548
|
-
config: {
|
|
549
|
-
name: 'my_widget',
|
|
550
|
-
title: 'My Widget', // Required for display
|
|
551
|
-
template: '<div>{{data.message}}</div>', // Required HTML
|
|
552
|
-
script: 'data.message = "Hello";', // ServiceNow uses 'script' field
|
|
553
|
-
client_script: 'function($scope) { var c = this; }'
|
|
554
|
-
}
|
|
555
|
-
})
|
|
103
|
+
snow_update_set_create - Create update set
|
|
104
|
+
snow_update_set_switch - Switch active set
|
|
105
|
+
snow_update_set_complete - Mark complete
|
|
106
|
+
snow_update_set_export - Export as XML
|
|
107
|
+
snow_update_set_preview - Preview changes
|
|
108
|
+
snow_ensure_active_update_set - Auto-create if needed
|
|
556
109
|
\`\`\`
|
|
557
110
|
|
|
558
|
-
**
|
|
559
|
-
\`\`\`
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
})
|
|
111
|
+
### 9. **servicenow-development-assistant** 🤖 AI Assistant
|
|
112
|
+
\`\`\`
|
|
113
|
+
snow_find_artifact - Find any artifact by name/type
|
|
114
|
+
snow_edit_artifact - Edit existing artifacts
|
|
115
|
+
snow_analyze_artifact - Analyze dependencies
|
|
116
|
+
snow_comprehensive_search - Deep search all tables
|
|
117
|
+
snow_analyze_requirements - Requirement analysis
|
|
118
|
+
snow_generate_code - Pattern-based generation
|
|
119
|
+
snow_optimize_script - Performance optimization
|
|
568
120
|
\`\`\`
|
|
569
121
|
|
|
570
|
-
###
|
|
571
|
-
|
|
572
|
-
-
|
|
573
|
-
-
|
|
574
|
-
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
### 1. ServiceNow Deployment Server
|
|
581
|
-
**Purpose:** Widget and artifact deployment with coherence validation
|
|
582
|
-
|
|
583
|
-
**Key Tools:**
|
|
584
|
-
- \`snow_deploy\` - Create NEW artifacts (widgets, pages, etc.) - use with \`type: 'widget'\`
|
|
585
|
-
- \`snow_update\` - UPDATE existing artifacts - use for widget field updates
|
|
586
|
-
- \`snow_validate_deployment\` - Validate deployed artifacts
|
|
587
|
-
- \`snow_rollback_deployment\` - Rollback failed deployments
|
|
588
|
-
- \`snow_preview_widget\` - Preview widget before deployment
|
|
589
|
-
- \`snow_widget_test\` - Test widget functionality
|
|
590
|
-
|
|
591
|
-
**Special Features:**
|
|
592
|
-
- Automatic widget coherence validation
|
|
593
|
-
- Data flow contract verification
|
|
594
|
-
- Method implementation checking
|
|
595
|
-
- CSS class validation
|
|
596
|
-
|
|
597
|
-
### 2. ServiceNow Operations Server
|
|
598
|
-
**Purpose:** Core ServiceNow operations and queries
|
|
599
|
-
|
|
600
|
-
**Key Tools:**
|
|
601
|
-
- \`snow_query_table\` - Universal table querying with pagination
|
|
602
|
-
- \`snow_query_incidents\` - Query and analyze incidents
|
|
603
|
-
- \`snow_cmdb_search\` - Search Configuration Management Database
|
|
604
|
-
- \`snow_user_lookup\` - Find and manage users
|
|
605
|
-
- \`snow_operational_metrics\` - Get operational metrics
|
|
606
|
-
- \`snow_knowledge_search\` - Search knowledge base
|
|
607
|
-
|
|
608
|
-
**Features:**
|
|
609
|
-
- Full CRUD operations on any table
|
|
610
|
-
- Advanced query capabilities
|
|
611
|
-
- Field discovery and validation
|
|
612
|
-
- Relationship navigation
|
|
613
|
-
|
|
614
|
-
### 3. ServiceNow Automation Server
|
|
615
|
-
**Purpose:** Script execution and automation
|
|
616
|
-
|
|
617
|
-
**🚨 CRITICAL: ALL SCRIPTS MUST BE ES5 ONLY!**
|
|
618
|
-
ServiceNow runs on Rhino engine - ES6+ syntax will cause SyntaxError and script failure.
|
|
619
|
-
|
|
620
|
-
**Key Tools:**
|
|
621
|
-
- \`snow_execute_background_script\` - Execute background scripts (**ES5 ONLY!** with optional autoConfirm)
|
|
622
|
-
- \`snow_confirm_script_execution\` - Confirm script execution after user approval
|
|
623
|
-
- \`snow_execute_script_with_output\` - Execute scripts with output capture (**ES5 ONLY!**)
|
|
624
|
-
- \`snow_get_script_output\` - Retrieve script execution history
|
|
625
|
-
- \`snow_execute_script_sync\` - Synchronous script execution (**ES5 ONLY!**)
|
|
626
|
-
- \`snow_get_logs\` - Access system logs
|
|
627
|
-
- \`snow_test_rest_connection\` - Test REST integrations
|
|
628
|
-
- \`snow_trace_execution\` - Trace script execution (**ES5 ONLY!**)
|
|
629
|
-
- \`snow_schedule_job\` - Create scheduled jobs
|
|
630
|
-
- \`snow_create_event\` - Trigger system events
|
|
631
|
-
|
|
632
|
-
**Remember:** Use \`var\`, \`function(){}\`, string concatenation, traditional for loops only!
|
|
633
|
-
|
|
634
|
-
**Features:**
|
|
635
|
-
- Full output capture (gs.print/info/warn/error)
|
|
636
|
-
- Execution history tracking
|
|
637
|
-
- System log access
|
|
638
|
-
- REST message testing
|
|
639
|
-
- Performance tracing
|
|
640
|
-
|
|
641
|
-
### 4. ServiceNow Platform Development Server
|
|
642
|
-
**Purpose:** Platform development artifacts
|
|
643
|
-
|
|
644
|
-
**Key Tools:**
|
|
645
|
-
- \`snow_create_ui_page\` - Create UI pages
|
|
646
|
-
- \`snow_create_script_include\` - Create reusable scripts
|
|
647
|
-
- \`snow_create_business_rule\` - Create business rules
|
|
648
|
-
- \`snow_create_client_script\` - Create client-side scripts
|
|
649
|
-
- \`snow_create_ui_policy\` - Create UI policies
|
|
650
|
-
- \`snow_create_ui_action\` - Create UI actions
|
|
651
|
-
|
|
652
|
-
**Features:**
|
|
653
|
-
- Full artifact creation
|
|
654
|
-
- Proper scoping support
|
|
655
|
-
- Condition builder integration
|
|
656
|
-
- Script validation
|
|
657
|
-
|
|
658
|
-
### 5. ServiceNow Integration Server
|
|
659
|
-
**Purpose:** Integration and data management
|
|
660
|
-
|
|
661
|
-
**Key Tools:**
|
|
662
|
-
- \`snow_create_rest_message\` - Create REST integrations
|
|
663
|
-
- \`snow_create_transform_map\` - Create data transformation maps
|
|
664
|
-
- \`snow_create_import_set\` - Manage import sets
|
|
665
|
-
- \`snow_test_web_service\` - Test web services
|
|
666
|
-
- \`snow_configure_email\` - Configure email settings
|
|
667
|
-
|
|
668
|
-
**Features:**
|
|
669
|
-
- REST/SOAP integration
|
|
670
|
-
- Data transformation
|
|
671
|
-
- Import/Export capabilities
|
|
672
|
-
- Email configuration
|
|
673
|
-
|
|
674
|
-
### 6. ServiceNow System Properties Server
|
|
675
|
-
**Purpose:** System property management
|
|
676
|
-
|
|
677
|
-
**Key Tools:**
|
|
678
|
-
- \`snow_property_get\` - Retrieve property values
|
|
679
|
-
- \`snow_property_set\` - Set property values
|
|
680
|
-
- \`snow_property_list\` - List properties by pattern
|
|
681
|
-
- \`snow_property_delete\` - Remove properties
|
|
682
|
-
- \`snow_property_bulk_update\` - Bulk operations
|
|
683
|
-
- \`snow_property_export\` - Export to JSON
|
|
684
|
-
- \`snow_property_import\` - Import from JSON
|
|
685
|
-
|
|
686
|
-
**Features:**
|
|
687
|
-
- Full CRUD on sys_properties
|
|
688
|
-
- Bulk operations
|
|
689
|
-
- Import/Export capabilities
|
|
690
|
-
- Property validation
|
|
691
|
-
|
|
692
|
-
### 7. ServiceNow Update Set Server
|
|
693
|
-
**Purpose:** Change management and deployment
|
|
694
|
-
|
|
695
|
-
**Key Tools:**
|
|
696
|
-
- \`snow_update_set_create\` - Create new update sets
|
|
697
|
-
- \`snow_update_set_switch\` - Switch active update set
|
|
698
|
-
- \`snow_update_set_current\` - Get current update set
|
|
699
|
-
- \`snow_update_set_complete\` - Mark as complete
|
|
700
|
-
- \`snow_update_set_export\` - Export as XML
|
|
701
|
-
- \`snow_ensure_active_update_set\` - Ensure update set is active
|
|
702
|
-
|
|
703
|
-
**Features:**
|
|
704
|
-
- Full update set lifecycle
|
|
705
|
-
- Change tracking
|
|
706
|
-
- XML export/import
|
|
707
|
-
- Conflict detection
|
|
708
|
-
|
|
709
|
-
### 8. ServiceNow Development Assistant Server
|
|
710
|
-
**Purpose:** Intelligent artifact search, editing and development assistance
|
|
711
|
-
|
|
712
|
-
**Key Tools:**
|
|
713
|
-
- \`snow_find_artifact\` - Find any ServiceNow artifact by name/type
|
|
714
|
-
- \`snow_edit_artifact\` - Edit existing artifacts intelligently
|
|
715
|
-
- \`snow_get_by_sysid\` - Get artifact by sys_id
|
|
716
|
-
- \`snow_analyze_artifact\` - Analyze artifact structure and dependencies
|
|
717
|
-
- \`snow_comprehensive_search\` - Deep search across all tables
|
|
718
|
-
- \`snow_analyze_requirements\` - Analyze development requirements
|
|
719
|
-
|
|
720
|
-
**Features:**
|
|
721
|
-
- Pattern-based code generation
|
|
722
|
-
- Best practice enforcement
|
|
723
|
-
- Performance optimization
|
|
724
|
-
- Security review
|
|
725
|
-
|
|
726
|
-
### 9. ServiceNow Security & Compliance Server
|
|
727
|
-
**Purpose:** Security and compliance management
|
|
728
|
-
|
|
729
|
-
**Key Tools:**
|
|
730
|
-
- \`snow_create_security_policy\` - Create security policies
|
|
731
|
-
- \`snow_audit_compliance\` - Compliance auditing
|
|
732
|
-
- \`snow_scan_vulnerabilities\` - Vulnerability scanning
|
|
733
|
-
- \`snow_assess_risk\` - Risk assessment
|
|
734
|
-
- \`snow_review_access_control\` - ACL review
|
|
735
|
-
|
|
736
|
-
**Features:**
|
|
737
|
-
- SOX/GDPR/HIPAA compliance
|
|
738
|
-
- Security policy management
|
|
739
|
-
- Vulnerability assessment
|
|
740
|
-
- Access control validation
|
|
741
|
-
|
|
742
|
-
### 10. ServiceNow Reporting & Analytics Server
|
|
743
|
-
**Purpose:** Reporting and data visualization
|
|
744
|
-
|
|
745
|
-
**Key Tools:**
|
|
746
|
-
- \`snow_create_report\` - Create reports
|
|
747
|
-
- \`snow_create_dashboard\` - Create dashboards
|
|
748
|
-
- \`snow_define_kpi\` - Define KPIs
|
|
749
|
-
- \`snow_schedule_report\` - Schedule report delivery
|
|
750
|
-
- \`snow_analyze_data_quality\` - Data quality analysis
|
|
751
|
-
|
|
752
|
-
**Features:**
|
|
753
|
-
- Advanced reporting
|
|
754
|
-
- Dashboard creation
|
|
755
|
-
- KPI management
|
|
756
|
-
- Scheduled delivery
|
|
757
|
-
|
|
758
|
-
### 11. ServiceNow Machine Learning Server
|
|
759
|
-
**Purpose:** AI/ML capabilities with TensorFlow.js and native ML integration
|
|
760
|
-
|
|
761
|
-
**Key Tools:**
|
|
762
|
-
- \`ml_train_incident_classifier\` - Train incident classifier with LSTM neural networks
|
|
763
|
-
- \`ml_predict_change_risk\` - Predict change risks
|
|
764
|
-
- \`ml_detect_anomalies\` - Anomaly detection
|
|
765
|
-
- \`ml_forecast_incidents\` - Incident forecasting with time series
|
|
766
|
-
- \`ml_performance_analytics\` - Native Performance Analytics ML
|
|
767
|
-
- \`ml_hybrid_recommendation\` - Hybrid ML recommendations
|
|
768
|
-
|
|
769
|
-
**Features:**
|
|
770
|
-
- Predictive analytics
|
|
771
|
-
- Pattern recognition
|
|
772
|
-
- Anomaly detection
|
|
773
|
-
- Process optimization
|
|
774
|
-
|
|
775
|
-
### 12. ServiceNow Local Development Server
|
|
776
|
-
**Purpose:** Bridge between ServiceNow artifacts and Claude Code's native development tools
|
|
777
|
-
|
|
778
|
-
**Key Tools:**
|
|
779
|
-
- \`snow_pull_artifact\` - Pull any ServiceNow artifact to local files
|
|
780
|
-
- \`snow_push_artifact\` - Push local changes back with validation
|
|
781
|
-
- \`snow_validate_artifact_coherence\` - Validate artifact relationships
|
|
782
|
-
- \`snow_list_supported_artifacts\` - List all supported artifact types
|
|
783
|
-
- \`snow_sync_status\` - Check sync status of local artifacts
|
|
784
|
-
- \`snow_sync_cleanup\` - Clean up local files after sync
|
|
785
|
-
- \`snow_convert_to_es5\` - Convert modern JavaScript to ES5
|
|
786
|
-
|
|
787
|
-
**Features:**
|
|
788
|
-
- Supports 12+ artifact types dynamically
|
|
789
|
-
- Smart field chunking for large artifacts
|
|
790
|
-
- ES5 validation for server-side scripts
|
|
791
|
-
- Coherence validation for widgets
|
|
792
|
-
- Full Claude Code native tool integration
|
|
793
|
-
|
|
794
|
-
**Supported Artifact Types:**
|
|
795
|
-
- Service Portal Widgets (\`sp_widget\`)
|
|
796
|
-
- Flow Designer Flows (\`sys_hub_flow\`)
|
|
797
|
-
- Script Includes (\`sys_script_include\`)
|
|
798
|
-
- Business Rules (\`sys_script\`)
|
|
799
|
-
- UI Pages (\`sys_ui_page\`)
|
|
800
|
-
- Client Scripts (\`sys_script_client\`)
|
|
801
|
-
- UI Policies (\`sys_ui_policy\`)
|
|
802
|
-
- REST Messages (\`sys_rest_message\`)
|
|
803
|
-
- Transform Maps (\`sys_transform_map\`)
|
|
804
|
-
- Scheduled Jobs (\`sysauto_script\`)
|
|
805
|
-
- Fix Scripts (\`sys_script_fix\`)
|
|
806
|
-
|
|
807
|
-
### 13. Snow-Flow Orchestration Server
|
|
808
|
-
**Purpose:** Multi-agent coordination and task management
|
|
809
|
-
|
|
810
|
-
**Key Tools:**
|
|
811
|
-
- \`swarm_init\` - Initialize agent swarms
|
|
812
|
-
- \`agent_spawn\` - Create specialized agents
|
|
813
|
-
- \`task_orchestrate\` - Orchestrate complex tasks
|
|
814
|
-
- \`memory_search\` - Search persistent memory
|
|
815
|
-
- \`neural_train\` - Train neural networks with TensorFlow.js
|
|
816
|
-
- \`performance_report\` - Generate performance reports
|
|
817
|
-
|
|
818
|
-
**Features:**
|
|
819
|
-
- Multi-agent coordination
|
|
820
|
-
- Task orchestration
|
|
821
|
-
- Neural network training (TensorFlow.js)
|
|
822
|
-
- Memory management
|
|
823
|
-
- Performance monitoring
|
|
824
|
-
|
|
825
|
-
### Additional Servers:
|
|
826
|
-
|
|
827
|
-
**ServiceNow CMDB/Event/HR/CSM/DevOps Server** - CI management, event correlation, HR processes, customer service, DevOps pipelines
|
|
828
|
-
|
|
829
|
-
**ServiceNow Knowledge & Catalog Server** - Knowledge articles, service catalog items, catalog variables and policies
|
|
830
|
-
|
|
831
|
-
**ServiceNow Change/Virtual Agent/PA Server** - Change management, virtual agent NLU, predictive analytics
|
|
832
|
-
|
|
833
|
-
**ServiceNow Flow/Workspace/Mobile Server** - Flow Designer, workspace configuration, mobile app management
|
|
834
|
-
|
|
835
|
-
**Features:**
|
|
836
|
-
- Multi-agent coordination
|
|
837
|
-
- Task orchestration
|
|
838
|
-
- Neural network training (TensorFlow.js)
|
|
839
|
-
- Memory management
|
|
840
|
-
- Performance monitoring
|
|
841
|
-
|
|
842
|
-
## Local Development with Artifact Sync
|
|
843
|
-
|
|
844
|
-
### Dynamic Artifact Synchronization
|
|
845
|
-
|
|
846
|
-
The Local Development Server enables editing ServiceNow artifacts using Claude Code's native file tools. This creates a powerful development bridge between ServiceNow and local development environments.
|
|
847
|
-
|
|
848
|
-
**Workflow:**
|
|
849
|
-
|
|
850
|
-
1. **Pull Artifact to Local Files**
|
|
851
|
-
\`\`\`javascript
|
|
852
|
-
// Auto-detect artifact type
|
|
853
|
-
snow_pull_artifact({ sys_id: 'any_sys_id' });
|
|
854
|
-
|
|
855
|
-
// Or specify table for faster pull
|
|
856
|
-
snow_pull_artifact({
|
|
857
|
-
sys_id: 'widget_sys_id',
|
|
858
|
-
table: 'sp_widget'
|
|
859
|
-
});
|
|
860
|
-
\`\`\`
|
|
861
|
-
|
|
862
|
-
2. **Edit with Claude Code Native Tools**
|
|
863
|
-
- Full search capabilities across files
|
|
864
|
-
- Multi-file editing and refactoring
|
|
865
|
-
- Syntax highlighting and validation
|
|
866
|
-
- Git-like diff viewing
|
|
867
|
-
- Go-to-definition and references
|
|
868
|
-
|
|
869
|
-
3. **Validate Coherence**
|
|
870
|
-
\`\`\`javascript
|
|
871
|
-
// Check artifact relationships
|
|
872
|
-
snow_validate_artifact_coherence({
|
|
873
|
-
sys_id: 'artifact_sys_id'
|
|
874
|
-
});
|
|
875
|
-
\`\`\`
|
|
876
|
-
|
|
877
|
-
4. **Push Changes Back**
|
|
878
|
-
\`\`\`javascript
|
|
879
|
-
// Push with automatic validation
|
|
880
|
-
snow_push_artifact({ sys_id: 'artifact_sys_id' });
|
|
881
|
-
|
|
882
|
-
// Force push despite warnings
|
|
883
|
-
snow_push_artifact({
|
|
884
|
-
sys_id: 'artifact_sys_id',
|
|
885
|
-
force: true
|
|
886
|
-
});
|
|
887
|
-
\`\`\`
|
|
888
|
-
|
|
889
|
-
5. **Clean Up**
|
|
890
|
-
\`\`\`javascript
|
|
891
|
-
// Remove local files after sync
|
|
892
|
-
snow_sync_cleanup({ sys_id: 'artifact_sys_id' });
|
|
893
|
-
\`\`\`
|
|
894
|
-
|
|
895
|
-
**Artifact Registry:**
|
|
896
|
-
|
|
897
|
-
Each artifact type is configured with:
|
|
898
|
-
- Field mappings to local files
|
|
899
|
-
- Context-aware wrappers for better editing
|
|
900
|
-
- ES5 validation flags for server scripts
|
|
901
|
-
- Coherence rules for interconnected fields
|
|
902
|
-
- Preprocessors/postprocessors for data transformation
|
|
122
|
+
### 10. **servicenow-security-compliance** 🛡️ Security
|
|
123
|
+
\`\`\`
|
|
124
|
+
snow_create_security_policy - Security policies
|
|
125
|
+
snow_audit_compliance - SOX/GDPR/HIPAA audit
|
|
126
|
+
snow_scan_vulnerabilities - Vulnerability scan
|
|
127
|
+
snow_assess_risk - Risk assessment
|
|
128
|
+
snow_review_access_control - ACL review
|
|
129
|
+
snow_encrypt_field - Field encryption
|
|
130
|
+
snow_audit_trail_analysis - Audit analysis
|
|
131
|
+
\`\`\`
|
|
903
132
|
|
|
904
|
-
**
|
|
133
|
+
### 11. **servicenow-reporting-analytics** 📈 Reporting
|
|
905
134
|
\`\`\`
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
│ ├── my_widget.css # Styles
|
|
913
|
-
│ ├── my_widget.config.json # Configuration
|
|
914
|
-
│ └── README.md # Context & instructions
|
|
915
|
-
├── script_includes/
|
|
916
|
-
│ └── MyScriptInclude/
|
|
917
|
-
│ ├── MyScriptInclude.js # Script
|
|
918
|
-
│ └── MyScriptInclude.docs.md # Documentation
|
|
919
|
-
└── business_rules/
|
|
920
|
-
└── my_rule/
|
|
921
|
-
├── my_rule.js # Rule script
|
|
922
|
-
└── my_rule.condition.js # Condition
|
|
135
|
+
snow_create_report - Create reports
|
|
136
|
+
snow_create_dashboard - Build dashboards
|
|
137
|
+
snow_define_kpi - Define KPIs
|
|
138
|
+
snow_schedule_report - Schedule delivery
|
|
139
|
+
snow_analyze_data_quality - Data quality
|
|
140
|
+
snow_create_pa_widget - Performance analytics
|
|
923
141
|
\`\`\`
|
|
924
142
|
|
|
925
|
-
**
|
|
926
|
-
|
|
927
|
-
-
|
|
928
|
-
-
|
|
929
|
-
-
|
|
930
|
-
-
|
|
931
|
-
-
|
|
143
|
+
### 12. **servicenow-machine-learning** 🧠 AI/ML
|
|
144
|
+
\`\`\`
|
|
145
|
+
ml_train_incident_classifier - Train LSTM classifier
|
|
146
|
+
ml_predict_change_risk - Risk prediction
|
|
147
|
+
ml_detect_anomalies - Anomaly detection
|
|
148
|
+
ml_forecast_incidents - Time series forecast
|
|
149
|
+
ml_cluster_similar - Similarity clustering
|
|
150
|
+
ml_performance_analytics - Native PA ML
|
|
151
|
+
\`\`\`
|
|
932
152
|
|
|
933
|
-
|
|
153
|
+
### 13. **servicenow-change-virtualagent-pa** 🔄 Change & Virtual Agent
|
|
154
|
+
\`\`\`
|
|
155
|
+
snow_create_change_request - Change requests
|
|
156
|
+
snow_assess_change_risk - Risk assessment
|
|
157
|
+
snow_create_nlu_model - NLU models
|
|
158
|
+
snow_train_virtual_agent - Train VA
|
|
159
|
+
snow_configure_conversation - VA conversations
|
|
160
|
+
snow_analyze_pa_trends - Performance trends
|
|
161
|
+
\`\`\`
|
|
934
162
|
|
|
935
|
-
###
|
|
163
|
+
### 14. **servicenow-cmdb-event-hr-csm-devops** 🏢 Enterprise
|
|
164
|
+
\`\`\`
|
|
165
|
+
snow_manage_ci - Configuration items
|
|
166
|
+
snow_correlate_events - Event correlation
|
|
167
|
+
snow_manage_hr_case - HR cases
|
|
168
|
+
snow_csm_project - Customer projects
|
|
169
|
+
snow_devops_pipeline - CI/CD pipelines
|
|
170
|
+
snow_manage_cmdb_relationships - CI relationships
|
|
171
|
+
\`\`\`
|
|
936
172
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
173
|
+
### 15. **servicenow-knowledge-catalog** 📚 Knowledge & Catalog
|
|
174
|
+
\`\`\`
|
|
175
|
+
snow_create_knowledge_article - KB articles
|
|
176
|
+
snow_manage_catalog_item - Catalog items
|
|
177
|
+
snow_configure_variables - Variable sets
|
|
178
|
+
snow_create_catalog_policy - Catalog policies
|
|
179
|
+
snow_manage_categories - Categories
|
|
180
|
+
\`\`\`
|
|
944
181
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
182
|
+
### 16. **servicenow-flow-workspace-mobile** 📱 Modern UX
|
|
183
|
+
\`\`\`
|
|
184
|
+
snow_create_flow - Flow Designer flows
|
|
185
|
+
snow_add_flow_action - Flow actions
|
|
186
|
+
snow_create_workspace - Workspace config
|
|
187
|
+
snow_configure_mobile_app - Mobile apps
|
|
188
|
+
snow_configure_offline_sync - Offline mode
|
|
189
|
+
\`\`\`
|
|
950
190
|
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
191
|
+
### 17. **servicenow-advanced-features** 🎯 Advanced
|
|
192
|
+
\`\`\`
|
|
193
|
+
snow_performance_optimization - Optimize instance
|
|
194
|
+
snow_batch_operations - Bulk processing
|
|
195
|
+
snow_instance_scan - Health check
|
|
196
|
+
snow_dependency_analysis - Dependencies
|
|
197
|
+
snow_code_search - Search all code
|
|
198
|
+
\`\`\`
|
|
955
199
|
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
200
|
+
### 18. **snow-flow** 🎛️ Orchestration
|
|
201
|
+
\`\`\`
|
|
202
|
+
swarm_init - Initialize agent swarms
|
|
203
|
+
agent_spawn - Create specialized agents
|
|
204
|
+
task_orchestrate - Complex task coordination
|
|
205
|
+
memory_search - Search persistent memory
|
|
206
|
+
neural_train - Train neural networks
|
|
207
|
+
\`\`\`
|
|
960
208
|
|
|
961
|
-
|
|
209
|
+
## 🔄 Critical Workflows
|
|
962
210
|
|
|
963
|
-
|
|
211
|
+
### Widget Debugging (ALWAYS use Local Sync!)
|
|
964
212
|
\`\`\`javascript
|
|
965
|
-
|
|
966
|
-
|
|
213
|
+
// ✅ CORRECT - Local sync for debugging
|
|
214
|
+
await snow_pull_artifact({ sys_id: 'widget_sys_id' });
|
|
215
|
+
// Edit with native tools (search, multi-file, etc.)
|
|
216
|
+
await snow_push_artifact({ sys_id: 'widget_sys_id' });
|
|
217
|
+
|
|
218
|
+
// ❌ WRONG - Token limit explosion
|
|
219
|
+
await snow_query_table({ table: 'sp_widget', query: 'sys_id=...' });
|
|
967
220
|
\`\`\`
|
|
968
221
|
|
|
969
|
-
|
|
222
|
+
### Verification Pattern
|
|
970
223
|
\`\`\`javascript
|
|
971
|
-
|
|
972
|
-
|
|
224
|
+
// Always verify with REAL data, not placeholders
|
|
225
|
+
await snow_execute_script_with_output({
|
|
226
|
+
script: \`
|
|
227
|
+
var gr = new GlideRecord('incident');
|
|
228
|
+
gr.addQuery('active', true);
|
|
229
|
+
gr.query();
|
|
230
|
+
gs.info('Found: ' + gr.getRowCount() + ' active incidents');
|
|
231
|
+
|
|
232
|
+
// Test actual property
|
|
233
|
+
var prop = gs.getProperty('instance_name');
|
|
234
|
+
gs.info('Instance: ' + prop);
|
|
235
|
+
\`
|
|
236
|
+
});
|
|
973
237
|
\`\`\`
|
|
974
238
|
|
|
975
|
-
|
|
239
|
+
### Complete Widget Creation (NO PLACEHOLDERS)
|
|
976
240
|
\`\`\`javascript
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
241
|
+
await snow_deploy({
|
|
242
|
+
type: 'widget',
|
|
243
|
+
config: {
|
|
244
|
+
name: 'my_widget',
|
|
245
|
+
title: 'Production Widget',
|
|
246
|
+
template: '<div ng-repeat="item in data.items">{{item.name}}</div>',
|
|
247
|
+
script: \`
|
|
248
|
+
(function() {
|
|
249
|
+
data.items = [];
|
|
250
|
+
var gr = new GlideRecord('incident');
|
|
251
|
+
gr.addQuery('active', true);
|
|
252
|
+
gr.setLimit(10);
|
|
253
|
+
gr.query();
|
|
254
|
+
while (gr.next()) {
|
|
255
|
+
data.items.push({
|
|
256
|
+
name: gr.getDisplayValue('number'),
|
|
257
|
+
description: gr.getDisplayValue('short_description')
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
})();
|
|
261
|
+
\`,
|
|
262
|
+
client_script: \`
|
|
263
|
+
function($scope) {
|
|
264
|
+
var c = this;
|
|
265
|
+
c.refresh = function() {
|
|
266
|
+
c.server.get().then(function(r) {
|
|
267
|
+
console.log('Refreshed');
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
\`
|
|
272
|
+
}
|
|
273
|
+
});
|
|
980
274
|
\`\`\`
|
|
981
275
|
|
|
982
|
-
## Command Reference
|
|
276
|
+
## ⚡ Command Reference
|
|
983
277
|
|
|
984
278
|
### Core Commands
|
|
985
|
-
-
|
|
986
|
-
-
|
|
987
|
-
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
### Testing Workflow
|
|
1022
|
-
1. Run unit tests with background scripts
|
|
1023
|
-
2. Test integrations with REST tools
|
|
1024
|
-
3. Validate UI with widget coherence
|
|
1025
|
-
4. Check performance with tracing
|
|
1026
|
-
5. Review logs for errors
|
|
1027
|
-
|
|
1028
|
-
### Debugging Workflow
|
|
1029
|
-
1. Reproduce issue exactly
|
|
1030
|
-
2. Gather evidence with scripts
|
|
1031
|
-
3. Verify all assumptions
|
|
1032
|
-
4. Apply minimal fixes
|
|
1033
|
-
5. Test thoroughly
|
|
1034
|
-
6. Document changes
|
|
1035
|
-
|
|
1036
|
-
## Important Reminders
|
|
1037
|
-
|
|
1038
|
-
### Always Remember
|
|
1039
|
-
- Every ServiceNow instance is unique
|
|
1040
|
-
- Custom implementations exist that you don't know about
|
|
1041
|
-
- Preview/beta features may be available
|
|
1042
|
-
- Organization-specific configurations are common
|
|
1043
|
-
- Test everything before making assumptions
|
|
1044
|
-
|
|
1045
|
-
### Never Assume
|
|
1046
|
-
- That something doesn't exist without verification
|
|
1047
|
-
- That configurations are wrong without testing
|
|
1048
|
-
- That APIs aren't available without checking
|
|
1049
|
-
- That code won't work without running it
|
|
1050
|
-
- That you know better than existing implementations
|
|
1051
|
-
|
|
1052
|
-
### Golden Rules
|
|
1053
|
-
1. **Verify First** - Test before declaring broken
|
|
1054
|
-
2. **ES5 Only** - No modern JavaScript in ServiceNow
|
|
1055
|
-
3. **Evidence-Based** - Make decisions on facts, not assumptions
|
|
1056
|
-
4. **Minimal Changes** - Fix only what's broken
|
|
1057
|
-
5. **Respect Context** - Understand why things exist as they do
|
|
1058
|
-
|
|
1059
|
-
## Conclusion
|
|
1060
|
-
|
|
1061
|
-
Snow-Flow is a powerful framework for ServiceNow development that emphasizes verification, testing, and evidence-based decision making. By following these guidelines and best practices, you ensure reliable, maintainable, and effective ServiceNow solutions.
|
|
1062
|
-
|
|
1063
|
-
Remember: Your job is to solve problems, not to judge implementations. Every environment has its reasons for existing configurations. Verify, test, and respect what you find.`;
|
|
279
|
+
- \`snow-flow init\` - Initialize project with this CLAUDE.md
|
|
280
|
+
- \`snow-flow auth login\` - Authenticate with ServiceNow
|
|
281
|
+
- \`snow-flow status\` - System status
|
|
282
|
+
- \`snow-flow swarm "<task>"\` - Multi-agent coordination
|
|
283
|
+
|
|
284
|
+
### Development Flow
|
|
285
|
+
1. **Pull artifact**: \`snow_pull_artifact\` for local editing
|
|
286
|
+
2. **Edit locally**: Use Claude's native search/edit tools
|
|
287
|
+
3. **Push changes**: \`snow_push_artifact\` to ServiceNow
|
|
288
|
+
4. **Test**: \`snow_execute_script_with_output\` with REAL code
|
|
289
|
+
5. **Deploy**: \`snow_update_set_complete\` when ready
|
|
290
|
+
|
|
291
|
+
## 🎯 Golden Rules
|
|
292
|
+
|
|
293
|
+
1. **NO MOCK DATA** - Everything real, complete, production-ready
|
|
294
|
+
2. **ES5 ONLY** - var, function(){}, no modern JS
|
|
295
|
+
3. **VERIFY FIRST** - Test before assuming
|
|
296
|
+
4. **LOCAL SYNC** - Use snow_pull_artifact for widgets
|
|
297
|
+
5. **COMPLETE CODE** - No TODOs, no placeholders
|
|
298
|
+
6. **TOKEN AWARE** - Use batch operations
|
|
299
|
+
7. **UPDATE SETS** - Track all changes
|
|
300
|
+
|
|
301
|
+
## 📊 Quick Reference
|
|
302
|
+
|
|
303
|
+
| Issue | Solution |
|
|
304
|
+
|-------|----------|
|
|
305
|
+
| Widget doesn't work | \`snow_pull_artifact\` → debug locally |
|
|
306
|
+
| Script syntax error | ES5 only! var, function(){} |
|
|
307
|
+
| Can't find table | \`snow_discover_table_fields\` |
|
|
308
|
+
| Property missing | \`snow_property_manager\` |
|
|
309
|
+
| Need to test | \`snow_execute_script_with_output\` |
|
|
310
|
+
| Deployment failed | \`snow_rollback_deployment\` |
|
|
311
|
+
|
|
312
|
+
Remember: TAKE THE TIME. DO IT RIGHT. NO MOCK DATA. NO EXCEPTIONS.`;
|
|
313
|
+
exports.CLAUDE_MD_TEMPLATE_VERSION = '3.6.2-CONSOLIDATED';
|
|
1064
314
|
//# sourceMappingURL=claude-md-template.js.map
|