logo

NJP

Trigger a Flow based on an Event (even if its scheduled)

New article articles in ServiceNow Community · Jan 23, 2025 · article

Had an AH HAH! moment yesterday I'd like to share.

I had always wished Flow could trigger based on a sysevent, but I never realized how simple it was until now.

This article will help you trigger flows based on events usually created by gs.eventQueue or gs.eventQueueScheduled.

LAUNCH A FLOW BASED ON AN EVENT
I suddenly realized. An event isn't anything special. Its just another record.

So I just looked for a record Created in the sysevent table. Then just conditioned the name of the event I might be looking for.

UncleRob_0-1737631331578.png

BUT WHAT IF THE EVENT IS SCHEDULED?
You've got two options. The first option is my favorite, and credit to @Chris Helming for pointing it out.

Option 1 - Create OR Update, but wait for State to be Processed.

For events that have a process_on in the future, the state will change to processed on that date/time.

UncleRob_1-1737631514949.png

Option 2 - Trigger but wait until Process On
In this case the event triggers the flow (even if its early) and its first action is to wait.

Wait until when? Until 100% of the time between now and the Process On date/time is consumed.

UncleRob_2-1737631654118.png

WHICH OPTION IN WHAT CIRCUMSTANCES?
If all action is being taken at the Process On date, then I'd use Option 1.

In some scenarios you may want SOME flow to start right away, and other parts to happen on the Process On date. In that case I'd use Option 2.

For the giggles

Remember that Washington release a Flow Action to Fire an Event, and you can easily make one of your own that could produced scheduled events.

So now you can both fire and trigger based on sysevents. AWESOME!

View original source

https://www.servicenow.com/community/workflow-automation-articles/trigger-a-flow-based-on-an-event-even-if-its-scheduled/ta-p/3157211