---
sourceDocument: Brazil ServiceNow AI Platform Capabilities
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/servicenow-platform

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil ServiceNow AI Platform Capabilities

ft:clusterId :

    - platcap

bundleId :

    - platcap

workflow :

    - Platform


---

# Workflow event-specific functions

# Workflow event-specific functions {#ariaid-title1}

Release version: Brazil  
Updated September 10, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 4 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Workflow event-specific functions

This content details a set of functions in the ServiceNow workflow environment specifically designed to manage workflow events.
These functions enable workflow activities to register for, unregister from, fire, and broadcast events during workflow execution.
They provide precise control over event-driven behavior within running workflows, improving flexibility and responsiveness.
Show full answer Show less  

## Key Features

* **registerForEvent(eventName):** Registers a workflow activity to listen for a specific event by adding the event name to the `wfexecuting.registeredevents` field. Available via the global `workflow` variable in activity scripts.
* **unRegisterForEvent(eventName):** Removes an event from the registered events list, stopping the activity from responding to that event.
* **fireEvent(eventName):** Triggers all executing workflow activities registered for the specified event, queuing these events for processing in the current thread and mutex.
* **fireEvent(eventRecord, eventName):** Sends an event to a specific `wfexecuting` record (a workflow activity instance), invoking its event handler. This is done through the Workflow script include and queues the event on its own mutex.
* **fireEvent(eventRecordSysId, eventName):** Similar to the above, but accepts the sysid of the `wfexecuting` record. Also accessed via the Workflow script include.
* **fireEvent(eventRecordSysId, eventName, optionalJSONObject):** Extends the previous method by allowing an additional JSON object parameter to pass extra data with the event.
* **broadcastEvent(contextId, eventName):** Sends an event to all currently running workflow activities in a specified context, regardless of their state, using the Workflow script include.
* **broadcastEvent(eventName):** Broadcasts an event to all running workflow activities in the current context via the global `workflow` variable.

## Practical Application for ServiceNow Customers

These workflow event functions empower you to design more dynamic and interactive workflows. You can:

* Register and unregister activities to respond to custom or system events dynamically during workflow execution.
* Trigger events globally or target them to specific workflow activities, enabling fine-grained control over workflow behavior.
* Pass additional data with events using JSON objects, facilitating complex data-driven workflow interactions.
* Broadcast events within a workflow context to synchronize multiple activities or trigger parallel processing.

Using these functions, workflow designers can build sophisticated event-driven logic that enhances automation and improves process responsiveness within ServiceNow workflows.  
There are several functions that relate specifically to workflow events.
{#r_WorkflowEventSpecificFunctions__table_d43_m5t_hp__entry__6}

| Function | Description | Purpose | Use | Thread | Source |
|-|-|-|-|-|-|
| registerForEvent (eventName) | Function in the workflow environment that writes events represented as strings to the `wf_executing.registered_events` field. | The workflow events are just strings. When an activity that has registered for an event executes, a comma delimited set of events is stored with the Workflow Executing Activity \[wf_executing\] record. When the event is triggered in the workflow context, the wf_executing table looks for all executing records that contain the string that represents the event in the `wf_executing.registered_events` field | The global variable workflow that is available to all Workflow Activity \[wf_activity\] records is the source of the call. For example, from inside a Run Script activity, a designer can write: `workflow.registerForEvent('myEventName');` | Current thread, current mutex | Global variable workflow |
| unRegisterForEvent (eventName) | Function in the workflow environment that removes a string value representing an event that has been written to the `wf_executing.registered_events` field. | The workflow events are just strings that are written to the `wf_executing.registered_events` field. When an activity unRegisters for an event, the comma delimited set of events stored with the Workflow Executing Activity \[wf_executing\] record is searched, and if that string is found, it is removed. | The global variable workflow that is available to all Workflow Activity \[wf_activity\] records is the source of the call. For example, from inside a Run Script activity, a designer can write: `workflow.unRegisterForEvent('myEventName');` | Current thread, current mutex | Global variable workflow |
| fireEvent (eventName) | Function in the workflow environment that examines the contents of the `wf_executing.registered_events` field, comparing its contents to the `eventName` passed in. | The workflow events are just strings that are written to the `wf_executing.registered_events` field. When fireEvent(eventName) is called by a workflow activity, the workflow engine queues up any executing records that contain the string in the registered field. | The global variable workflow that is available to all Workflow Activity \[wf_activity\] records is the source of the call. For example, from inside a Run Script activity, a designer can write: `workflow.fireEvent('myEventName');` | Current thread, current mutex | Global variable workflow |
| fireEvent (eventRecord, eventName) | Function in the workflow environment that sends an event to a specific Workflow Executing Activity \[wf_executing\] record. The `eventRecord` is a GlideRecord of the type wf_executing. | This event call expects an onMyEvent event handler in the activity represented in the event record (Workflow Executing Activity \[wf_executing\] table). When fireEvent(eventRecord, eventName) is called by a workflow activity, the workflow engine queues up the specific executing record with that event and passes the event into the activity definition for the on\<eventName\> handler to manage. This event is queued up in its own mutex, so the current queue completes before this event is processed. | The workflow script include contains the call for this. For example, from inside a Run Script activity, a designer can write: `var w = new Workflow(); w.fireEvent(executing, eventName);` | Current thread, current mutex | Workflow script include |
| fireEvent (eventRecordSysId, eventName) | Function in the workflow environment that sends an event to a specific Workflow Executing Activity \[wf_executing\] record. The `eventRecordSysId` is the sys_id of a GlideRecord of the type wf_executing. | This is the same as the fireEvent above, except that it accepts an ID and returns the Workflow Executing Activity \[wf_executing\] record. | The Workflow script include contains the call for this. For example, from inside a Run Script activity, a designer can write: `var w = new Workflow(); w.fireEvent(executing, eventName);` | Current thread, current mutex | Workflow script include |
| fireEvent (eventRecordSysId, eventName, optionalJSONObject) | Function in the workflow environment that sends an event to a specific Workflow Executing Activity \[wf_executing\] record. The `eventRecordSysId` is the sys_id of a GlideRecord of the type wf_executing. | This is the same as the fireEvent above, except that it accepts a JSON object as a third parameter. This object can specify any data expressible as JSON. You can also specify additional functionality when creating a workflow activity. | The Workflow script include contains the call for this. For example, from inside a Run Script activity, a designer can write: `var w = new Workflow(); w.fireEvent(executing, eventName, JSONObject);` | Current thread, current mutex | Workflow script include |
| broadcastEvent (contextId, eventName) | Function in the workflow environment that sends an event to all currently running Workflow Executing Activity \[wf_executing\] records in a specified context, regardless of their state. | This is the same as the fireEvent above, except that it accepts an ID and returns the Workflow Executing Activity \[wf_executing\] record. | The Workflow script include contains the call for this. For example, from inside a Run Script activity, a designer can write: `var w = new Workflow(); w.broadcastEvent(contextId, eventName);` | Current thread, current mutex | Workflow script include |
| broadcastEvent (eventName) | Function in the workflow environment that sends an event to all currently running Workflow Executing Activity \[wf_executing\] records in the current context, regardless of their state. | This should not be confused with broadcastEvent above. This event is only available to current Workflow Executing Activity \[wf_executing\] records. | This is available only through the global workflow variable of the current context. The following is an example of its use from within an activity definition's script: `workflow.broadcastEvent(eventName)` | Current thread, current mutex | Global variable workflow |
[Table 1. Workflow event-specific functions]

{#r_WorkflowEventSpecificFunctions__table_d43_m5t_hp}

