snow-flow 2.10.0 → 3.0.0
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.
- package/.mcp.json +13 -141
- package/.mcp.json.template +11 -25
- package/README.md +18 -0
- package/claude-flow +81 -0
- package/claude-flow.bat +18 -0
- package/claude-flow.config.json +20 -0
- package/claude-flow.ps1 +24 -0
- package/dist/agents/index.d.ts +3 -10
- package/dist/agents/index.js +10 -50
- package/dist/agents/queen-agent.d.ts +0 -2
- package/dist/agents/queen-agent.js +25 -42
- package/dist/cli.js +1 -1
- package/dist/mcp/servicenow-automation-mcp.js +10 -10
- package/dist/mcp/servicenow-deployment-mcp.js +1050 -169
- package/dist/mcp/servicenow-development-assistant-mcp.js +13 -65
- package/dist/mcp/servicenow-integration-mcp.js +10 -10
- package/dist/mcp/servicenow-machine-learning-mcp.js +15 -15
- package/dist/mcp/servicenow-operations-mcp.js +23 -23
- package/dist/mcp/servicenow-platform-development-mcp.js +9 -9
- package/dist/mcp/servicenow-reporting-analytics-mcp.js +11 -11
- package/dist/mcp/servicenow-security-compliance-mcp.js +11 -11
- package/dist/mcp/servicenow-update-set-mcp.js +9 -9
- package/dist/mcp/shared/reliable-memory-manager.d.ts +78 -0
- package/dist/mcp/shared/reliable-memory-manager.js +268 -0
- package/dist/mcp/snow-flow-mcp.js +341 -87
- package/dist/queen/agent-factory.d.ts +4 -2
- package/dist/queen/agent-factory.js +72 -25
- package/dist/services/tensorflow-ml-service.d.ts +105 -0
- package/dist/services/tensorflow-ml-service.js +456 -0
- package/dist/services/widget-deployment-service.d.ts +107 -0
- package/dist/services/widget-deployment-service.js +332 -0
- package/dist/utils/file-storage-fallback.d.ts +62 -0
- package/dist/utils/file-storage-fallback.js +289 -0
- package/dist/utils/mcp-server-manager.js +4 -7
- package/dist/utils/mcp-singleton-enforcer.d.ts +7 -1
- package/dist/utils/mcp-singleton-enforcer.js +28 -4
- package/dist/utils/mcp-timeout-fix.d.ts +10 -1
- package/dist/utils/mcp-timeout-fix.js +80 -6
- package/memory/agents/README.md +31 -0
- package/memory/claude-flow-data.json +1 -1
- package/memory/sessions/README.md +1 -1
- package/package.json +4 -2
- package/src/agents/README.md +192 -0
- package/src/health/README.md +161 -0
- package/src/memory/README.md +240 -0
- package/src/queen/README.md +403 -0
- package/src/schemas/deployment.schema.json +58 -0
- package/src/schemas/flow.schema.json +79 -0
- package/src/schemas/widget.schema.json +72 -0
- package/src/templates/base/application.template.json +45 -0
- package/src/templates/base/business_rule.template.json +33 -0
- package/src/templates/base/script_include.template.json +18 -0
- package/src/templates/base/table.template.json +64 -0
- package/src/templates/base/widget.template.json +25 -0
- package/src/templates/patterns/composite.incident-management.template.json +140 -0
- package/src/templates/patterns/widget.dashboard.template.json +238 -0
- package/src/templates/patterns/widget.datatable.template.json +292 -0
- package/dist/mcp/servicenow-graph-memory-mcp.js +0 -728
- package/servicenow/widgets/openai_incident_classifier/client_controller.js +0 -284
- package/servicenow/widgets/openai_incident_classifier/server_script.js +0 -314
- package/servicenow/widgets/openai_incident_classifier/style.css +0 -354
- package/servicenow/widgets/openai_incident_classifier/template.html +0 -167
- package/servicenow/widgets/openai_incident_classifier/widget.json +0 -86
- package/test-ml-improvements.sh +0 -76
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "ServiceNow Flow Configuration Schema",
|
|
4
|
+
"description": "Schema for validating ServiceNow Flow Designer flow configurations",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["name", "description", "trigger_type"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"minLength": 1,
|
|
11
|
+
"maxLength": 100,
|
|
12
|
+
"description": "Flow name"
|
|
13
|
+
},
|
|
14
|
+
"description": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"minLength": 1,
|
|
17
|
+
"maxLength": 500,
|
|
18
|
+
"description": "Flow description"
|
|
19
|
+
},
|
|
20
|
+
"trigger_type": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"enum": ["record_created", "record_updated", "scheduled", "manual"],
|
|
23
|
+
"description": "Flow trigger type"
|
|
24
|
+
},
|
|
25
|
+
"table": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "Target table for record-based triggers"
|
|
28
|
+
},
|
|
29
|
+
"condition": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Trigger condition (encoded query)"
|
|
32
|
+
},
|
|
33
|
+
"category": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Flow category (e.g., approval, automation)"
|
|
36
|
+
},
|
|
37
|
+
"active": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"default": true,
|
|
40
|
+
"description": "Whether the flow is active"
|
|
41
|
+
},
|
|
42
|
+
"flow_definition": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "Flow Designer definition JSON"
|
|
45
|
+
},
|
|
46
|
+
"flow_type": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"enum": ["flow", "subflow", "action"],
|
|
49
|
+
"default": "flow",
|
|
50
|
+
"description": "Type of flow to create"
|
|
51
|
+
},
|
|
52
|
+
"validate_before_deploy": {
|
|
53
|
+
"type": "boolean",
|
|
54
|
+
"default": true,
|
|
55
|
+
"description": "Validate flow definition before deployment"
|
|
56
|
+
},
|
|
57
|
+
"sys_scope": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "Application scope (global or application sys_id)"
|
|
60
|
+
},
|
|
61
|
+
"run_as": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"enum": ["system", "user"],
|
|
64
|
+
"default": "system",
|
|
65
|
+
"description": "Context for flow execution"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"additionalProperties": false,
|
|
69
|
+
"if": {
|
|
70
|
+
"properties": {
|
|
71
|
+
"trigger_type": {
|
|
72
|
+
"enum": ["record_created", "record_updated"]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"then": {
|
|
77
|
+
"required": ["table"]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "ServiceNow Widget Configuration Schema",
|
|
4
|
+
"description": "Schema for validating ServiceNow Service Portal widget configurations",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["name", "title", "template"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"pattern": "^[a-z][a-z0-9_]*$",
|
|
11
|
+
"description": "Internal widget name (lowercase, underscores allowed)"
|
|
12
|
+
},
|
|
13
|
+
"title": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1,
|
|
16
|
+
"maxLength": 100,
|
|
17
|
+
"description": "Display title for the widget"
|
|
18
|
+
},
|
|
19
|
+
"description": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"maxLength": 500,
|
|
22
|
+
"description": "Widget description"
|
|
23
|
+
},
|
|
24
|
+
"category": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"default": "custom",
|
|
27
|
+
"description": "Widget category for organization"
|
|
28
|
+
},
|
|
29
|
+
"template": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"minLength": 1,
|
|
32
|
+
"description": "HTML template for the widget"
|
|
33
|
+
},
|
|
34
|
+
"css": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "CSS styles for the widget"
|
|
37
|
+
},
|
|
38
|
+
"client_script": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "Client-side JavaScript controller"
|
|
41
|
+
},
|
|
42
|
+
"server_script": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "Server-side script for data processing"
|
|
45
|
+
},
|
|
46
|
+
"option_schema": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"default": "[]",
|
|
49
|
+
"description": "JSON schema for widget options"
|
|
50
|
+
},
|
|
51
|
+
"demo_data": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"default": "{}",
|
|
54
|
+
"description": "Demo data for widget preview"
|
|
55
|
+
},
|
|
56
|
+
"has_preview": {
|
|
57
|
+
"type": "boolean",
|
|
58
|
+
"default": true,
|
|
59
|
+
"description": "Whether widget supports preview mode"
|
|
60
|
+
},
|
|
61
|
+
"sys_scope": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "Application scope (global or application sys_id)"
|
|
64
|
+
},
|
|
65
|
+
"active": {
|
|
66
|
+
"type": "boolean",
|
|
67
|
+
"default": true,
|
|
68
|
+
"description": "Whether the widget is active"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"additionalProperties": false
|
|
72
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "application",
|
|
3
|
+
"name": "{{APPLICATION_NAME}}",
|
|
4
|
+
"description": "{{APPLICATION_DESCRIPTION}}",
|
|
5
|
+
"config": {
|
|
6
|
+
"name": "{{APPLICATION_NAME}}",
|
|
7
|
+
"scope": "{{SCOPE|x_custom}}",
|
|
8
|
+
"version": "{{VERSION|1.0.0}}",
|
|
9
|
+
"short_description": "{{SHORT_DESCRIPTION}}",
|
|
10
|
+
"description": "{{APPLICATION_DESCRIPTION}}",
|
|
11
|
+
"vendor": "{{VENDOR|Custom}}",
|
|
12
|
+
"vendor_prefix": "{{VENDOR_PREFIX|x}}",
|
|
13
|
+
"runtime_access_tracking": "{{RUNTIME_ACCESS_TRACKING|permissive}}",
|
|
14
|
+
"enforce_license": {{ENFORCE_LICENSE|none}},
|
|
15
|
+
"active": true,
|
|
16
|
+
"licensable": {{LICENSABLE|false}},
|
|
17
|
+
"installable": {{INSTALLABLE|true}},
|
|
18
|
+
"accessible_from": "{{ACCESSIBLE_FROM|All application scopes}}",
|
|
19
|
+
"application_access": "{{APPLICATION_ACCESS|Can read}}",
|
|
20
|
+
"tables": [],
|
|
21
|
+
"menu": {
|
|
22
|
+
"label": "{{MENU_LABEL|APPLICATION_NAME}}",
|
|
23
|
+
"hint": "{{MENU_HINT|Access APPLICATION_NAME}}",
|
|
24
|
+
"order": {{MENU_ORDER|100}}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"variables": {
|
|
28
|
+
"APPLICATION_NAME": "My Custom Application",
|
|
29
|
+
"APPLICATION_DESCRIPTION": "A custom ServiceNow application",
|
|
30
|
+
"SCOPE": "x_custom",
|
|
31
|
+
"VERSION": "1.0.0",
|
|
32
|
+
"SHORT_DESCRIPTION": "Custom application for ServiceNow",
|
|
33
|
+
"VENDOR": "Custom",
|
|
34
|
+
"VENDOR_PREFIX": "x",
|
|
35
|
+
"RUNTIME_ACCESS_TRACKING": "permissive",
|
|
36
|
+
"ENFORCE_LICENSE": "none",
|
|
37
|
+
"LICENSABLE": false,
|
|
38
|
+
"INSTALLABLE": true,
|
|
39
|
+
"ACCESSIBLE_FROM": "All application scopes",
|
|
40
|
+
"APPLICATION_ACCESS": "Can read",
|
|
41
|
+
"MENU_LABEL": "My Custom Application",
|
|
42
|
+
"MENU_HINT": "Access My Custom Application",
|
|
43
|
+
"MENU_ORDER": 100
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "business_rule",
|
|
3
|
+
"name": "{{BUSINESS_RULE_NAME}}",
|
|
4
|
+
"description": "{{BUSINESS_RULE_DESCRIPTION}}",
|
|
5
|
+
"config": {
|
|
6
|
+
"name": "{{BUSINESS_RULE_NAME}}",
|
|
7
|
+
"table": "{{TABLE|incident}}",
|
|
8
|
+
"when": "{{WHEN|before}}",
|
|
9
|
+
"condition": "{{CONDITION|}}",
|
|
10
|
+
"script": "// Business Rule: {{BUSINESS_RULE_NAME}}\n(function executeRule(current, previous /*null when async*/) {\n // {{BUSINESS_RULE_DESCRIPTION}}\n \n {{BUSINESS_LOGIC|// Add your business logic here}}\n \n})(current, previous);",
|
|
11
|
+
"active": true,
|
|
12
|
+
"order": {{ORDER|100}},
|
|
13
|
+
"advanced": true,
|
|
14
|
+
"collection": "{{TABLE|incident}}",
|
|
15
|
+
"action_insert": {{ACTION_INSERT|true}},
|
|
16
|
+
"action_update": {{ACTION_UPDATE|true}},
|
|
17
|
+
"action_delete": {{ACTION_DELETE|false}},
|
|
18
|
+
"action_query": {{ACTION_QUERY|false}}
|
|
19
|
+
},
|
|
20
|
+
"variables": {
|
|
21
|
+
"BUSINESS_RULE_NAME": "My Business Rule",
|
|
22
|
+
"BUSINESS_RULE_DESCRIPTION": "A custom business rule for ServiceNow",
|
|
23
|
+
"TABLE": "incident",
|
|
24
|
+
"WHEN": "before",
|
|
25
|
+
"CONDITION": "",
|
|
26
|
+
"ORDER": 100,
|
|
27
|
+
"ACTION_INSERT": true,
|
|
28
|
+
"ACTION_UPDATE": true,
|
|
29
|
+
"ACTION_DELETE": false,
|
|
30
|
+
"ACTION_QUERY": false,
|
|
31
|
+
"BUSINESS_LOGIC": "// Add your business logic here"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "script_include",
|
|
3
|
+
"name": "{{CLASS_NAME}}",
|
|
4
|
+
"description": "{{DESCRIPTION}}",
|
|
5
|
+
"config": {
|
|
6
|
+
"api_name": "{{API_NAME|CLASS_NAME}}",
|
|
7
|
+
"access": "{{ACCESS|public}}",
|
|
8
|
+
"active": true,
|
|
9
|
+
"script": "var {{CLASS_NAME}} = Class.create();\n{{CLASS_NAME}}.prototype = {\n initialize: function() {\n // Constructor\n },\n \n // Add your methods here\n {{METHOD_NAME|exampleMethod}}: function() {\n // Method implementation\n return true;\n },\n \n type: '{{CLASS_NAME}}'\n};"
|
|
10
|
+
},
|
|
11
|
+
"variables": {
|
|
12
|
+
"CLASS_NAME": "MyUtilityClass",
|
|
13
|
+
"DESCRIPTION": "Utility functions for ServiceNow",
|
|
14
|
+
"API_NAME": "MyUtilityClass",
|
|
15
|
+
"ACCESS": "public",
|
|
16
|
+
"METHOD_NAME": "exampleMethod"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "table",
|
|
3
|
+
"name": "{{TABLE_NAME}}",
|
|
4
|
+
"description": "{{TABLE_DESCRIPTION}}",
|
|
5
|
+
"config": {
|
|
6
|
+
"name": "{{TABLE_NAME}}",
|
|
7
|
+
"label": "{{LABEL}}",
|
|
8
|
+
"plural": "{{PLURAL}}",
|
|
9
|
+
"extends_table": "{{EXTENDS_TABLE|task}}",
|
|
10
|
+
"number_ref": {
|
|
11
|
+
"table": "{{TABLE_NAME}}",
|
|
12
|
+
"prefix": "{{PREFIX|CUSTOM}}"
|
|
13
|
+
},
|
|
14
|
+
"access": "{{ACCESS|public}}",
|
|
15
|
+
"create_access_controls": {{CREATE_ACCESS_CONTROLS|true}},
|
|
16
|
+
"live_feed_enabled": {{LIVE_FEED_ENABLED|false}},
|
|
17
|
+
"is_extendable": {{IS_EXTENDABLE|true}},
|
|
18
|
+
"create_module": {{CREATE_MODULE|true}},
|
|
19
|
+
"icon": "{{ICON|}}",
|
|
20
|
+
"user_role": "{{USER_ROLE|}}",
|
|
21
|
+
"fields": [
|
|
22
|
+
{
|
|
23
|
+
"column_name": "{{FIELD1_NAME|description}}",
|
|
24
|
+
"column_label": "{{FIELD1_LABEL|Description}}",
|
|
25
|
+
"type": "{{FIELD1_TYPE|string}}",
|
|
26
|
+
"max_length": {{FIELD1_LENGTH|255}},
|
|
27
|
+
"mandatory": {{FIELD1_MANDATORY|false}},
|
|
28
|
+
"display": {{FIELD1_DISPLAY|true}},
|
|
29
|
+
"active": true
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"acls": {
|
|
33
|
+
"create": "{{ACL_CREATE|true}}",
|
|
34
|
+
"read": "{{ACL_READ|true}}",
|
|
35
|
+
"write": "{{ACL_WRITE|true}}",
|
|
36
|
+
"delete": "{{ACL_DELETE|admin}}"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"variables": {
|
|
40
|
+
"TABLE_NAME": "u_custom_table",
|
|
41
|
+
"TABLE_DESCRIPTION": "A custom ServiceNow table",
|
|
42
|
+
"LABEL": "Custom Table",
|
|
43
|
+
"PLURAL": "Custom Tables",
|
|
44
|
+
"EXTENDS_TABLE": "task",
|
|
45
|
+
"PREFIX": "CUSTOM",
|
|
46
|
+
"ACCESS": "public",
|
|
47
|
+
"CREATE_ACCESS_CONTROLS": true,
|
|
48
|
+
"LIVE_FEED_ENABLED": false,
|
|
49
|
+
"IS_EXTENDABLE": true,
|
|
50
|
+
"CREATE_MODULE": true,
|
|
51
|
+
"ICON": "",
|
|
52
|
+
"USER_ROLE": "",
|
|
53
|
+
"FIELD1_NAME": "description",
|
|
54
|
+
"FIELD1_LABEL": "Description",
|
|
55
|
+
"FIELD1_TYPE": "string",
|
|
56
|
+
"FIELD1_LENGTH": 255,
|
|
57
|
+
"FIELD1_MANDATORY": false,
|
|
58
|
+
"FIELD1_DISPLAY": true,
|
|
59
|
+
"ACL_CREATE": "true",
|
|
60
|
+
"ACL_READ": "true",
|
|
61
|
+
"ACL_WRITE": "true",
|
|
62
|
+
"ACL_DELETE": "admin"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "widget",
|
|
3
|
+
"name": "{{WIDGET_NAME}}",
|
|
4
|
+
"description": "{{WIDGET_DESCRIPTION}}",
|
|
5
|
+
"config": {
|
|
6
|
+
"id": "{{WIDGET_ID}}",
|
|
7
|
+
"title": "{{WIDGET_TITLE}}",
|
|
8
|
+
"category": "{{CATEGORY|custom}}",
|
|
9
|
+
"template": "<div class=\"{{WIDGET_CLASS}}\">\n <!-- Widget HTML here -->\n</div>",
|
|
10
|
+
"css": ".{{WIDGET_CLASS}} {\n /* Widget styles here */\n}",
|
|
11
|
+
"client_script": "function() {\n var c = this;\n \n // Client controller logic here\n c.data = c.data || {};\n}",
|
|
12
|
+
"server_script": "(function() {\n // Server script logic here\n data = data || {};\n \n // Fetch data from ServiceNow\n \n})()",
|
|
13
|
+
"option_schema": "[]",
|
|
14
|
+
"demo_data": "{}",
|
|
15
|
+
"has_preview": true
|
|
16
|
+
},
|
|
17
|
+
"variables": {
|
|
18
|
+
"WIDGET_NAME": "My Widget",
|
|
19
|
+
"WIDGET_DESCRIPTION": "A custom ServiceNow widget",
|
|
20
|
+
"WIDGET_ID": "my_widget",
|
|
21
|
+
"WIDGET_TITLE": "My Widget",
|
|
22
|
+
"WIDGET_CLASS": "my-widget",
|
|
23
|
+
"CATEGORY": "custom"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "composite",
|
|
3
|
+
"name": "Incident Management System Template",
|
|
4
|
+
"description": "Complete incident management system with dashboard, workflows, and automation",
|
|
5
|
+
"category": "patterns/composite",
|
|
6
|
+
"artifacts": [
|
|
7
|
+
{
|
|
8
|
+
"type": "widget",
|
|
9
|
+
"template": "patterns/widget.dashboard",
|
|
10
|
+
"variables": {
|
|
11
|
+
"WIDGET_NAME": "incident_dashboard",
|
|
12
|
+
"WIDGET_TITLE": "Incident Management Dashboard",
|
|
13
|
+
"WIDGET_DESCRIPTION": "Real-time incident tracking and analytics",
|
|
14
|
+
"TABLE_NAME": "incident"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"type": "widget",
|
|
19
|
+
"template": "patterns/widget.datatable",
|
|
20
|
+
"variables": {
|
|
21
|
+
"WIDGET_NAME": "incident_list",
|
|
22
|
+
"WIDGET_TITLE": "Active Incidents",
|
|
23
|
+
"WIDGET_DESCRIPTION": "Interactive list of active incidents",
|
|
24
|
+
"TABLE_NAME": "incident",
|
|
25
|
+
"ENABLE_INLINE_EDIT": "true"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"type": "flow",
|
|
30
|
+
"template": "patterns/flow.approval",
|
|
31
|
+
"variables": {
|
|
32
|
+
"FLOW_NAME": "incident_escalation",
|
|
33
|
+
"FLOW_DESCRIPTION": "Automatic incident escalation based on priority and age",
|
|
34
|
+
"TABLE_NAME": "incident",
|
|
35
|
+
"TRIGGER_TYPE": "scheduled",
|
|
36
|
+
"TRIGGER_CONDITION": "priority IN (1,2) AND state != 'resolved'"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"type": "business_rule",
|
|
41
|
+
"template": "base/business_rule",
|
|
42
|
+
"variables": {
|
|
43
|
+
"NAME": "incident_auto_assignment",
|
|
44
|
+
"DESCRIPTION": "Automatically assign incidents based on category",
|
|
45
|
+
"TABLE": "incident",
|
|
46
|
+
"WHEN": "before",
|
|
47
|
+
"CONDITION": "current.assigned_to.nil() && !current.category.nil()",
|
|
48
|
+
"SCRIPT": "// Auto-assignment logic\nvar category = current.getValue('category');\nvar assignmentGroup = '';\n\nswitch(category) {\n case 'hardware':\n assignmentGroup = 'hardware_support';\n break;\n case 'software':\n assignmentGroup = 'software_support';\n break;\n case 'network':\n assignmentGroup = 'network_support';\n break;\n default:\n assignmentGroup = 'service_desk';\n}\n\ncurrent.assignment_group = assignmentGroup;"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "script_include",
|
|
53
|
+
"template": "base/script_include",
|
|
54
|
+
"variables": {
|
|
55
|
+
"CLASS_NAME": "IncidentAnalytics",
|
|
56
|
+
"DESCRIPTION": "Utility functions for incident analytics and reporting",
|
|
57
|
+
"SCRIPT": "var IncidentAnalytics = Class.create();\nIncidentAnalytics.prototype = {\n initialize: function() {},\n \n getMetrics: function() {\n var metrics = {};\n \n // Total incidents\n var gr = new GlideRecord('incident');\n gr.addActiveQuery();\n gr.query();\n metrics.total = gr.getRowCount();\n \n // By priority\n var priorities = {};\n gr = new GlideRecord('incident');\n gr.addActiveQuery();\n gr.query();\n while (gr.next()) {\n var priority = gr.getValue('priority') || 'undefined';\n priorities[priority] = (priorities[priority] || 0) + 1;\n }\n metrics.byPriority = priorities;\n \n // Average resolution time\n gr = new GlideRecord('incident');\n gr.addQuery('state', 'resolved');\n gr.orderByDesc('sys_updated_on');\n gr.setLimit(100);\n gr.query();\n \n var totalTime = 0;\n var count = 0;\n while (gr.next()) {\n var created = new GlideDateTime(gr.sys_created_on);\n var resolved = new GlideDateTime(gr.resolved_at);\n if (resolved.getNumericValue() > created.getNumericValue()) {\n totalTime += resolved.getNumericValue() - created.getNumericValue();\n count++;\n }\n }\n \n if (count > 0) {\n metrics.avgResolutionTime = Math.round(totalTime / count / 1000 / 60); // minutes\n }\n \n return metrics;\n },\n \n type: 'IncidentAnalytics'\n};"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"type": "table",
|
|
62
|
+
"template": "base/table",
|
|
63
|
+
"variables": {
|
|
64
|
+
"NAME": "u_incident_metrics",
|
|
65
|
+
"LABEL": "Incident Metrics",
|
|
66
|
+
"EXTENDS": "sys_metadata",
|
|
67
|
+
"FIELDS": [
|
|
68
|
+
{
|
|
69
|
+
"name": "metric_date",
|
|
70
|
+
"label": "Metric Date",
|
|
71
|
+
"type": "glide_date",
|
|
72
|
+
"mandatory": true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "total_incidents",
|
|
76
|
+
"label": "Total Incidents",
|
|
77
|
+
"type": "integer",
|
|
78
|
+
"default": "0"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "high_priority",
|
|
82
|
+
"label": "High Priority",
|
|
83
|
+
"type": "integer",
|
|
84
|
+
"default": "0"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "avg_resolution_time",
|
|
88
|
+
"label": "Avg Resolution Time (min)",
|
|
89
|
+
"type": "decimal",
|
|
90
|
+
"default": "0"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "sla_breaches",
|
|
94
|
+
"label": "SLA Breaches",
|
|
95
|
+
"type": "integer",
|
|
96
|
+
"default": "0"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"dependencies": [
|
|
103
|
+
{
|
|
104
|
+
"from": "widget.incident_dashboard",
|
|
105
|
+
"to": "script_include.IncidentAnalytics",
|
|
106
|
+
"type": "uses"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"from": "flow.incident_escalation",
|
|
110
|
+
"to": "table.incident",
|
|
111
|
+
"type": "updates"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"from": "business_rule.incident_auto_assignment",
|
|
115
|
+
"to": "table.incident",
|
|
116
|
+
"type": "triggers_on"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"from": "script_include.IncidentAnalytics",
|
|
120
|
+
"to": "table.u_incident_metrics",
|
|
121
|
+
"type": "writes_to"
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"deployment_order": [
|
|
125
|
+
"table.u_incident_metrics",
|
|
126
|
+
"script_include.IncidentAnalytics",
|
|
127
|
+
"business_rule.incident_auto_assignment",
|
|
128
|
+
"flow.incident_escalation",
|
|
129
|
+
"widget.incident_list",
|
|
130
|
+
"widget.incident_dashboard"
|
|
131
|
+
],
|
|
132
|
+
"variables": {
|
|
133
|
+
"SYSTEM_NAME": "Incident Management",
|
|
134
|
+
"SYSTEM_PREFIX": "inc_mgmt",
|
|
135
|
+
"PRIMARY_TABLE": "incident",
|
|
136
|
+
"NOTIFICATION_GROUP": "incident_managers",
|
|
137
|
+
"SLA_WARNING_THRESHOLD": "80",
|
|
138
|
+
"ESCALATION_TIMEOUT": "3600"
|
|
139
|
+
}
|
|
140
|
+
}
|