
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 05-03-2022 02:33 AM
Fire an event via Flow
Features:
- One action for all tables
- Select existing events
- Easy to use
Backstory:
Since we fire all our notifications via an event, we have the need to fire events also via "Flows". All research I found was unsatisfactory. It got suggested to create a custom action per table or create a record on the event table. There has also been the request to make this available OOTB (Please upvote).
The main goal of this event is, to be easily and intuitively usable and does what it's supposed to do: Simply fire an event.
Step-by-Step Guide:
- Create a new Action
-
- Action name: "Fire an event"
- Application: "Global"
- Accessible From: "All application scopes"
- Protection: "None"
- Category: <your choice>
- Description: <your description>
- Create Inputs
-
- Event Name
-
- Label: Event Name
- Name: event_name
- Type: Reference to Event Registration [sysevent_register]
- Mandatory: true
- Event Record
-
- Label: Event Record
- Name: event_record
- Type: Document ID
-
- This reference type is the critical part, which the other solutions missed.
- It allows to drag & drop any kind of record into the field.
- Mandatory: true
- Parm1
-
- Label: Parm1
- Name: parm1
- Type: String
- Mandatory: false
- Parm2
-
- Label: Parm2
- Name: parm2
- Type: String
- Mandatory: false
- Add a new Step
-
- Script (under Section "Utilities")
- Required Runtime: Instance
- Create Input Variables
-
- Name: event_name
-
- Value: Drag "action > Event Name > Event Name" data pill into the field.
- Name: event_record
-
- Value: Drag "action > Event Record" data pill into the field.
- Name: parm1
-
- Value: Drag "action > Parm1" data pill into the field.
- Name: parm2
-
- Value: Drag "action > Parm2" data pill into the field.
- Add a script
-
-
(function execute(inputs, outputs) { gs.eventQueue(inputs.event_name, inputs.event_record, inputs.parm1, inputs.parm2); /** If the event_log shows "[object GlideRecord]" as the event name use this instead: gs.eventQueue(inputs.event_name, inputs.event_record, inputs.parm1, inputs.parm2); Thanks to @Monika Bhoyate for pointing it out. */ })(inputs, outputs);
-
- Save & Publish
Usage:
Drag the Action into your flow and use like any scripted event mechanism.
Make sure you only drag records into the the "Event Record" field
Any questions? Please let me know.
Simon Ohle
P.S.: Make sure to upvote the OOTB Feature Idea
- 19,898 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Nice article!
I have linked it on https://community.servicenow.com/community?id=community_article&sys_id=ea4372301b4a0150cdd555fa234bc...
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I enjoy seeing how people are making Flow Designer more usable to fit their specific circumstances.
An alternative route that I have discovered to trigger notifications within flow designer is to use the OOB 'Send Notification' Action.
- In order to be able to use this you will need to update the notification records themselves to 'Send When' = 'Triggered'.
- This will then allow the notification to show up in the dropdown list of that action.
I like the custom action, but just wanted to throw that snippet of information in there for people who might find it helpful.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks for sharing! I indeed did not know that.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Interesting article, thanks for mentioning this article.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
hi,
first of all, thx for sharing.
Then, I tried your solution but is not working, see attachments.
Am I missing something?
thx,
Antonio
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
The input type of 'Document ID' requires you select a reference table. Is the idea to select 'Document ID.task'? If yes, wouldn't that only enable it to be used for task extended tables?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I tried this, but the option 'Send to event creator' does not seem to work then.
Did this work for you?
Thanks.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Did you try it out? I can drop any record there and dont have to provide a table.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Simon,
Thanks for wonderful article. I tried to trigger event "incident.assigned" from flow for "Incident assigned to me" notification. It is firing an event just fine but notification is not getting triggered. In event log it shows [object GlideRecord] as event name, not actual event name. I have attached the snapshot for reference.
Regards,
Monika
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I figured it out! I changed below code:
(function execute(inputs, outputs) {
gs.eventQueue(inputs.event_name, inputs.event_record, inputs.parm1, inputs.parm2);
})(inputs, outputs);
To:
(function execute(inputs, outputs) {
gs.eventQueue(inputs.event_name.event_name, inputs.event_record, inputs.parm1, inputs.parm2);
})(inputs, outputs);
Now I am getting event name instead of [object GlideRecord].
Regards,
Monika
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I figured it out! I changed below code:
(function execute(inputs, outputs) {
gs.eventQueue(inputs.event_name, inputs.event_record, inputs.parm1, inputs.parm2);
})(inputs, outputs);
To:
(function execute(inputs, outputs) {
gs.eventQueue(inputs.event_name.event_name, inputs.event_record, inputs.parm1, inputs.parm2);
})(inputs, outputs);
Now I am getting event name instead of [object GlideRecord].
Regards,
Monika
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I did something similar that will also let you use gs.eventQueueScheduled if you fill in an additional (datetime) parameter.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Monika,
thanks for pointing it out. I adjusted my post!
Cheers,
Simon
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Have you tried this in any scope application ex, HR scope. I am not able to do it or the event does not trigger
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Great post, however, do we really need to have reference field to invent registry? I could use string and event name supply to the field should do same magic..
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Bibeeshmt1 - Hadn't considered this but I totally agree. I can't remember any time I needed access to the event record itself. Every time I've ever used an event it was for the name only.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Unfortunately I am not able to update my original post, so here are some adjustments/enhancements, as pointed out by other users:
1. As @Bibeeshmt1 mentioned I recommend to not reference the Event Registry, but use "String" Event name as input. Thank you!
1.1 This solves also the work-around in the script, so input.event_name works.
2. The Comment in the script with the hint towards @Monika Bhoyate1 s tip also has a spelling error, it has to be
"inputs.event_name.event_name" instead of "inputs.event_name"
2.1 But is not necessary if point one here is used.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @Simon Ohle ,
My application is scoped application. It tried this method to fire an event.
But when I am executing the flow, the event is getting fired in event log but with state "error". In the instance field it is taking null, instead of record sys_id. And also not taking URI and parm1.
while calling this custom action, I have taken event name, event record, and parm1 correctly. I don't know why it is not taking record sys_id and URI. Could you please provide the solution to it..
Thank you

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This doesn't seem to work in a scope app, the reference table is no longer available.
The closest one I found is is UA Event Registry [ua_sysevent_register] in the drop down for Reference.
I guess we can script the Fire Event action as above, rather than usinfg the Fire Event action. Or just write a schedule task rather than a flow.
This is using yokohama patch4b in 2025.