How to Trigger an Event from a UI Action Button in ServiceNow
- kelly.ryu
- Mar 17
- 2 min read
Updated: Apr 1

Triggering events directly from a UI Action button in ServiceNow is a common yet essential task for many administrators and developers. It simplifies workflows, enables automated email notifications, and enhances the user experience by automating interactions directly from the interface. This article will provide a clear explanation and step-by-step guide on how to trigger events from UI Action buttons effectively.
Understanding UI Actions and Event Triggering in ServiceNow
UI Actions in ServiceNow allow users to perform operations like sending emails, updating records, or triggering events directly from a form or list interface. When configured correctly, a UI Action button can seamlessly integrate with the platform's backend logic, automating complex workflows and saving valuable user time.
In this article, we'll focus specifically on using UI Actions to trigger events that subsequently execute email notifications. This method streamlines the email communication process, significantly reducing manual intervention and ensuring accurate notifications.
Common Causes and Troubleshooting Steps
If you've encountered an issue with your UI Action button not triggering an event properly, don't worry—it's a common hurdle. Here's what you should know:
Typical issues include:
Incorrect placement of server-side scripts.
Misconfigured event parameters (event.param1 or event.param2).
Event and notification being set on different tables.
Using nonexistent or incorrectly defined events.
Step-by-Step Solution: How to Properly Trigger Events Using UI Actions
Follow these verified steps to successfully trigger an event directly from your UI Action:
Step 1: Ensure Server-side Execution
Events must be triggered from the server-side script of the UI Action. Client-side scripts cannot directly invoke ServiceNow events.
Step 2: Implement gs.eventQueue()
In your server-side UI Action script, use the following syntax:
gs.eventQueue('your_event_name', current, 'parameter1', 'parameter2');
event.name: Replace with your event's actual name.
recordObject: Usually current (the current record), but can reference any GlideRecord object.
event.parm1 and event.parm2: Optional parameters that pass additional details.
Here's a practical example:
var incidentRecord = new GlideRecord('incident');
incidentRecord.get('insert_record_sys_id_here');
gs.eventQueue('incident.email.notify', incidentRecord, gs.getUserName(), 'Incident Notification Triggered');
Step 3: Verify Event and Notification Configuration
Make sure your event exists in the ServiceNow Event Registry and your Email Notification is correctly set to trigger on this event.
Navigate to System Policy > Events > Registry and confirm your event exists.
Check the Email Notification configuration to ensure it's listening for this specific event.
Ensure "parm2 contains recipient" is checked if you're passing recipients via parameters.
Step 4: Testing Your UI Action
Before going live, always test your event triggering using Scripts - Background. Example:
var current = new GlideRecord('incident');
current.get('sys_id_of_incident');
gs.eventQueue('your.event', current, gs.getUserName(), 'Test Subject');
Verify this triggers the expected notification.
Alternative Solution
If your notification scenario is simple, you could consider triggering emails directly from a business rule after inserting or updating a record. However, using gs.eventQueue() within a UI Action provides greater control and immediate user-triggered action.
Conclusion and Next Steps
Triggering events from a UI Action is straightforward once you understand the correct server-side approach using gs.eventQueue(). Always verify event existence, notification configurations, and correct parameter usage.
For next steps:
Review existing UI Actions in your instance as practical references.
Experiment with parameters (parm1, parm2) for richer notification content.
Regularly test your notifications from UI Actions to ensure reliability.
By carefully applying these guidelines, you’ll streamline your ServiceNow workflows and ensure accurate, efficient notifications directly triggered by your UI Actions.