reporting-dashboards
Build ServiceNow reports (list/bar/pie/line/pivot/single-score) on sys_report, sys_dashboard layouts with widget placement, scheduled report delivery, and drill-down configuration.
notification-events
Use ServiceNow events (sysevent) — gs.eventQueue dispatch, sysevent_register definitions, sysevent_script_action handlers, delayed events with process_on, and reminder/state-change patterns.
Full skill instructions
Events trigger notifications, scripts, and workflows in ServiceNow.
gs.eventQueue() → Event Queue (sysevent)
↓
Event Registry (sysevent_register)
↓
Script Actions (sysevent_script_action)
Notifications (sysevent_email_action)
| Table | Purpose |
|---|---|
sysevent | Event queue |
sysevent_register | Event registry |
sysevent_script_action | Script actions |
sysevent_email_action | Email notifications |
// Register event in sysevent_register (ES5 ONLY!)
var event = new GlideRecord("sysevent_register")
event.initialize()
event.setValue("event_name", "x_myapp.incident.escalated")
event.setValue("table", "incident")
event.setValue("description", "Fired when an incident is escalated")
event.setValue("fired_by", "Business Rules, Scripts")
// Parameters
event.setValue("parm1", "escalation_level")
event.setValue("parm2", "previous_group")
event.insert()
// Queue event from script (ES5 ONLY!)
// gs.eventQueue(event_name, gr, parm1, parm2)
// In a Business Rule
;(function executeRule(current, previous) {
// Check if escalated
if (current.escalation.changesTo("1")) {
gs.eventQueue(
"x_myapp.incident.escalated",
current,
current.getValue("escalation"),
previous.assignment_group.getDisplayValue(),
)
}
})(current, previous)
// Access event parameters in script action (ES5 ONLY!)
// event.parm1 = first parameter
// event.parm2 = second parameter
// In Script Action
;(function executeEvent(event) {
var escalationLevel = event.parm1
var previousGroup = event.parm2
var incident = event.getGlideRecord()
gs.info(
"Incident " + incident.getValue("number") + " escalated to level " + escalationLevel + " from " + previousGroup,
)
// Perform action based on event
if (escalationLevel === "1") {
notifyManager(incident)
} else if (escalationLevel === "2") {
notifyDirector(incident)
} else if (escalationLevel === "3") {
notifyVP(incident)
}
})(event)
// Create script action for event (ES5 ONLY!)
var action = new GlideRecord("sysevent_script_action")
action.initialize()
action.setValue("name", "Handle Incident Escalation")
action.setValue("event_name", "x_myapp.incident.escalated")
action.setValue("active", true)
// Condition (optional)
action.setValue("condition", "event.parm1 >= 2")
// Script (ES5 ONLY!)
action.setValue(
"script",
"(function executeEvent(event) {\n" +
" var incident = event.getGlideRecord();\n" +
" var escalationLevel = event.parm1;\n" +
" \n" +
" // Create escalation task\n" +
' var task = new GlideRecord("task");\n' +
" task.initialize();\n" +
" task.parent = incident.getUniqueValue();\n" +
' task.short_description = "Review escalated incident";\n' +
" task.assignment_group = getEscalationGroup(escalationLevel);\n" +
" task.insert();\n" +
" \n" +
' gs.info("Created escalation task for " + incident.number);\n' +
"})(event);",
)
action.insert()
// Queue event with delay (ES5 ONLY!)
// Will be processed after specified time
var delay = new GlideDateTime()
delay.addSeconds(3600) // 1 hour delay
var event = new GlideRecord("sysevent")
event.initialize()
event.setValue("name", "x_myapp.reminder.send")
event.setValue("instance", recordSysId)
event.setValue("table", "incident")
event.setValue("parm1", "first_reminder")
event.setValue("parm2", "")
event.setValue("claimed", false)
event.setValue("process_on", delay)
event.insert()
// Create notification for event (ES5 ONLY!)
var notification = new GlideRecord("sysevent_email_action")
notification.initialize()
notification.setValue("name", "Incident Escalation Notification")
notification.setValue("event_name", "x_myapp.incident.escalated")
notification.setValue("active", true)
// Recipients
notification.setValue("recipient_users", "")
notification.setValue("recipient_groups", getGroupSysId("IT Management"))
notification.setValue("send_self", false)
// Use event.parm1 to get escalation manager
notification.setValue("recipient_fields", "assignment_group.manager")
// Email content
notification.setValue("subject", "Incident ${number} Escalated - Level ${event.parm1}")
notification.setValue(
"message_html",
"<p>Incident <b>${number}</b> has been escalated.</p>" +
"<p>Short Description: ${short_description}</p>" +
"<p>Escalation Level: ${event.parm1}</p>" +
"<p>Previous Group: ${event.parm2}</p>" +
'<p><a href="${URI_REF}">View Incident</a></p>',
)
notification.insert()
// Notification with advanced condition (ES5 ONLY!)
var notification = new GlideRecord("sysevent_email_action")
notification.initialize()
notification.setValue("name", "VIP Incident Alert")
notification.setValue("event_name", "incident.created")
// Advanced condition script
notification.setValue("advanced_condition", true)
notification.setValue("condition", "current.caller_id.vip == true && current.priority <= 2")
// Send to specific recipients for VIP
notification.setValue("recipient_groups", getGroupSysId("VIP Support"))
notification.insert()
// Schedule reminder events (ES5 ONLY!)
function scheduleReminder(tableName, recordSysId, reminderType, delayMinutes) {
var eventTime = new GlideDateTime()
eventTime.addSeconds(delayMinutes * 60)
var reminder = new GlideRecord("sysevent")
reminder.initialize()
reminder.setValue("name", "x_myapp.reminder")
reminder.setValue("instance", recordSysId)
reminder.setValue("table", tableName)
reminder.setValue("parm1", reminderType)
reminder.setValue("process_on", eventTime)
reminder.insert()
return reminder.getUniqueValue()
}
// Cancel scheduled reminder
function cancelReminder(eventSysId) {
var reminder = new GlideRecord("sysevent")
if (reminder.get(eventSysId)) {
reminder.deleteRecord()
return true
}
return false
}
// Queue batch processing (ES5 ONLY!)
// Business Rule: after, insert, u_import_batch
;(function executeRule(current, previous) {
// Queue processing for each record in batch
var record = new GlideRecord("u_import_record")
record.addQuery("batch", current.getUniqueValue())
record.query()
while (record.next()) {
gs.eventQueue("x_myapp.import.process_record", record, current.getUniqueValue(), "")
}
// Queue completion check
var delay = new GlideDateTime()
delay.addSeconds(300) // Check in 5 minutes
var event = new GlideRecord("sysevent")
event.initialize()
event.setValue("name", "x_myapp.import.check_complete")
event.setValue("instance", current.getUniqueValue())
event.setValue("table", "u_import_batch")
event.setValue("process_on", delay)
event.insert()
})(current, previous)
// Generic state change event (ES5 ONLY!)
// Business Rule: after, update
;(function executeRule(current, previous) {
if (current.state.changes()) {
gs.eventQueue(
"x_myapp." + current.getTableName() + ".state_change",
current,
previous.getValue("state"),
current.getValue("state"),
)
}
})(current, previous)
// Query pending events (ES5 ONLY!)
function getPendingEvents(eventName) {
var events = []
var event = new GlideRecord("sysevent")
event.addQuery("name", eventName)
event.addQuery("claimed", false)
event.orderByDesc("sys_created_on")
event.setLimit(100)
event.query()
while (event.next()) {
events.push({
sys_id: event.getUniqueValue(),
name: event.getValue("name"),
instance: event.getValue("instance"),
parm1: event.getValue("parm1"),
parm2: event.getValue("parm2"),
process_on: event.getValue("process_on"),
created: event.getValue("sys_created_on"),
})
}
return events
}
| Tool | Purpose |
|---|---|
snow_create_event | Queue events |
snow_query_table | Query event queue |
snow_find_artifact | Find event configurations |
snow_execute_script_with_output | Test event scripts |
// 1. Queue an event
await snow_create_event({
name: "x_myapp.test.event",
table: "incident",
instance: incidentSysId,
parm1: "test_value",
})
// 2. Check event queue
await snow_query_table({
table: "sysevent",
query: "name=x_myapp.test.event^claimed=false",
fields: "name,instance,parm1,parm2,process_on",
})
// 3. Find script actions
await snow_query_table({
table: "sysevent_script_action",
query: "event_nameLIKEx_myapp",
fields: "name,event_name,active,condition",
})
Build ServiceNow reports (list/bar/pie/line/pivot/single-score) on sys_report, sys_dashboard layouts with widget placement, scheduled report delivery, and drill-down configuration.
Make outbound REST calls from ServiceNow with sn_ws.RESTMessageV2 — basic/bearer/OAuth/API-key auth, error handling by status code, response parsing, sys_rest_message records, and retry with exponential backoff.
Use tool_search to discover and enable lazy-loaded Serac MCP tools (snow_*, jira_*, github_*, etc). Explains naming conventions, search strategies, and always-available activity tools.
Build ServiceNow Automated Test Framework tests and suites — impersonation, form steps, assertions, server-side script steps, test parameters, and execution via snow_create_atf_test / snow_execute_atf_test.
Move data in and out of ServiceNow — CSV parsing into import sets, GlideImportSetTransformer runs, CSV/JSON/XML exports, scheduled data sources, bulk update and deleteMultiple safety patterns.
Configure ServiceNow Discovery — schedules, IP ranges, credential affinities, MID Server assignment, custom probes/sensors, identification rules, and run-status monitoring on discovery_* tables.
Build ServiceNow Customer Service Management — customer_account, customer_contact, sn_customerservice_case routing, service entitlements with usage decrement, and Customer Portal case submission widgets.
Manage ServiceNow dictionary (sys_dictionary), table/field creation, choice lists, dictionary overrides, and sys_data_policy2 rules that enforce mandatory/read-only/visible field behavior on the data layer.
Configure ServiceNow Mobile (Now Mobile/Agent) — sys_sg_mobile_app screens, card builders, push notifications, offline sync rules, mobile actions for barcode/GPS, and offline-queue change processing.
Create ServiceNow sysevent_email_action notifications — templates with substitution variables, mail scripts for dynamic content/recipients/attachments, custom events, weights, and digest configuration.
Enforce ES5-only syntax for ServiceNow server-side scripts (Rhino engine) — convert const/let, arrow functions, template literals, destructuring, for-of, and async/await to ES5 equivalents.
Create and transition ServiceNow change requests (normal/standard/emergency), change tasks, affected CIs, approval routing, CAB scheduling, and conflict detection across maintenance windows.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience