Declarative Actions in ServiceNow – The Complete Guide
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2025 02:13 AM
1. Introduction
Declarative Actions (DAs) in ServiceNow provide a low‑code way to add interactive buttons across modern “Next Experience” interfaces—like Configurable Workspace or Service Operations Workspace—without touching the UI . This guide walks through DA basics, types, setup, and use in Workspace.
2. What Are Declarative Actions?
Evolved from UI Actions (Core UI), built for flexible components, not just lists/forms
Designed to work with UI Builder components: lists, forms, playbooks, catalogs, etc.
Coexist with UI Actions; DAs do not appear in legacy Core UI, only in Next Experience interfaces .
3. DA Types & Interface Contexts
ServiceNow supports many DA types across components :
List, Related List, Form, Field, Attachment, Catalog Wizard, Playbook, Kanban, EVAM, etc.
Definitions are stored in sys_declarative_action_model_definition and associated context fields in sys_declarative_action_model_field.
4. DA Execution Methods
DAs can run via three implementation types :
Client Script – browser-side logic using GlideForm/GlideList.
Server Script – server-side operations leveraging current, action, etc.
UXF Client Action – dispatches a JSON payload event to be handled by UI Builder.
UXF actions allow communication with UI Builder page handlers to perform modals, navigation, data-refresh, etc.
5. Key Personas
Component Author: Defines which components can host DAs; sets available data context.
Page Author: Creates UI Builder pages; sets up event handlers and possible payload schemas.
Declarative Action Author: Uses Action Assignment to create new DAs aligned to the page’s capabilities .
6. Context & Payloads
Client-side context includes selected record IDs for lists, field values, etc. defined in model field tables .
Payload definitions (JSON schema) allow UXF Client Actions to send structured data to page handlers .
7. Creating a Declarative Action
7.1 Via Action Assignment (sys_declarative_action_assignment)
Navigate via relevant modules (e.g., List Actions, Field Decorators, Action Bar Declarative Actions) .
Select Action Model (type), Label, Conditions, Roles, and Implementation type.
7.2 Example: “Re‑Open Incident” (Server Script)
Module: Action Bar Declarative Actions
Conditions: state = Resolved, user has write access
Server Script:
jsCopyEditcurrent.state = 1; // New current.update(); action.setRedirectURL(current); gs.addInfoMessage('Incident ' + current.number + ' reopened.');Assign the DA to the workspace via UX Action Configuration and add to Form Layout .
7.3 Example: “Add” Button on Related List (UXF Client Action)
Module: Related List Actions
Create Action Payload Definition (JSON with fields: label, table, parentRecordSysId, etc.) n.
Map the payload to a page event (RECORD#OPEN_MODAL) via sys_ux_addon_event_mapping .
8. Wiring Payload to UI Builder
In UI Builder, map Declarative Action to a handled event:
Choose the Source DA and page component ID (e.g., record_page_tabs_1)
Link to handled event (e.g., Open Modal or Open Tab)
Define payload mapping using JSON template
9. Execution Flow Summary
User clicks DA button in Workspace
DA evaluates Client/Server/UXF action
UXF action dispatches JSON payload event
Page Author’s event handler in UI Builder reads payload and performs behavior (modal, navigation, data refresh)
10. Best Practices
Use conditions and roles to show DAs contextually
Keep DAs reusable across pages
For UXF Client Actions, ensure page has handlers and payload schemas defined by Page Author
Configure layout and grouping via sys_ux_form_action. , sys_declarative_action_group, etc.
11. Reference Tables
sys_declarative_action_assignment | Core DA record |
sys_declarative_action_model_definition | DA model types |
sys_declarative_action_model_field | Context data available per model |
sys_declarative_action_payload_definition | JSON payload schema |
sys_ux_addon_event_mapping | Maps DA to page handled event |
UX layout & config tables (sys_ux_form_action, group, layout) | Control DA visibility and placement servicenow.com+2servicenow.com+2youtube.com+2youtube.com+2reddit.com+2youtube.com+2 |
12. Conclusion
Declarative Actions empower admins and developers to deliver powerful, context-aware buttons and interactions within Next Experience Workspaces—without customizing UI Builder directly. By understanding DA models, implementation types, payloads, and event-handling, you can rapidly add modern UX capabilities to your environment.
- 1,382 Views