- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
This blog summarizes the distinctions between Inbound Action Scripts, Script Actions, Scripted REST APIs, and Outbound Notifications in ServiceNow. It includes use cases, script contexts, examples, and a placeholder for a visual architecture diagram.
Comparison Table
Feature |
Direction |
Trigger Source |
Script Context |
Use Case |
Inbound Action Script |
Inbound (Email) |
Incoming email |
`current`, `email` |
Parse and process incoming emails |
Script Action |
Outbound (Event-driven) |
Internal event (`gs.eventQueue`) |
`current`, `event` |
Respond to internal system events |
Scripted REST API |
Inbound (API) |
External system (e.g., Zscaler) |
`request`, `response`, `gs`, etc. |
Accept data from external systems |
Outbound Notification |
Outbound |
Business Rule, Event, Flow |
`current`, `event`, `email`, etc. |
Notify users or systems of changes |
Use Case Examples
Inbound Action Script Example
Use Case: Create or update an Incident when an email is received.
Script:
if (email.subject.indexOf("P1") > -1) {
current.urgency = 1;
current.impact = 1;
current.priority = 1;
}
current.short_description = email.subject;
current.description = email.body_text;
Script Action Example
Use Case: Send a Slack message when a P1 incident is created.
Script:
if (current.priority == 1) {
var msg = "P1 Incident Created: " + current.number + " - " + current.short_description;
gs.info(msg);
}
Scripted REST API Example
Use Case: Zscaler sends a security breach alert to ServiceNow to create a P1 incident.
Script:
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var body = request.body.data;
var inc = new GlideRecord('incident');
inc.initialize();
inc.short_description = body.alert_name;
inc.description = body.details;
inc.urgency = 1;
inc.impact = 1;
inc.priority = 1;
inc.insert();
response.setStatus(201);
})(request, response);
Outbound Notification Example
Use Case: Notify the security team when a breach is logged.
Script:
gs.eventQueue('security.breach.logged', current, current.number, current.short_description);
Then in a Script Action:
var msg = "Security breach logged: " + event.parm1 + " - " + event.parm2;
gs.info(msg);
Then in a Script Action:
var msg = "Security breach logged: " + event.parm1 + " - " + event.parm2;
gs.info(msg); // or send to external system
Key Takeaways
- Inbound Action Scripts are only for email processing.
- Script Actions are event-driven and used for internal automation.
- REST APIs are the go-to for external system integrations (like Zscaler).
- Events in ServiceNow are internal signals, not external triggers.
- All of these are server-side and can be combined for powerful automation.
- 175 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.