From 06b6684aff847c19ae31b95b550645a9126a2222 Mon Sep 17 00:00:00 2001 From: bharakm Date: Sun, 19 Oct 2025 15:13:46 -0500 Subject: [PATCH 1/4] Create Expire Timers in Flow --- Client-Side Components/UI Actions/Expire Timers in Flow | 1 + 1 file changed, 1 insertion(+) create mode 100644 Client-Side Components/UI Actions/Expire Timers in Flow diff --git a/Client-Side Components/UI Actions/Expire Timers in Flow b/Client-Side Components/UI Actions/Expire Timers in Flow new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/Client-Side Components/UI Actions/Expire Timers in Flow @@ -0,0 +1 @@ + From c8d11c46bee0ba5a9cec8a279ea6e21ce335756e Mon Sep 17 00:00:00 2001 From: bharakm Date: Sun, 19 Oct 2025 15:15:49 -0500 Subject: [PATCH 2/4] Rename Expire Timers in Flow to Expire Timers in Flow.docs --- .../{Expire Timers in Flow => Expire Timers in Flow.docs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Client-Side Components/UI Actions/{Expire Timers in Flow => Expire Timers in Flow.docs} (100%) diff --git a/Client-Side Components/UI Actions/Expire Timers in Flow b/Client-Side Components/UI Actions/Expire Timers in Flow.docs similarity index 100% rename from Client-Side Components/UI Actions/Expire Timers in Flow rename to Client-Side Components/UI Actions/Expire Timers in Flow.docs From 2aebec3d0c1c193eba568061c8261597aff4e488 Mon Sep 17 00:00:00 2001 From: bharakm Date: Sun, 19 Oct 2025 15:17:35 -0500 Subject: [PATCH 3/4] Create script.js --- .../Expire Timer in Flows/script.js | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Client-Side Components/UI Actions/Expire Timer in Flows/script.js diff --git a/Client-Side Components/UI Actions/Expire Timer in Flows/script.js b/Client-Side Components/UI Actions/Expire Timer in Flows/script.js new file mode 100644 index 0000000000..8d8d67704c --- /dev/null +++ b/Client-Side Components/UI Actions/Expire Timer in Flows/script.js @@ -0,0 +1,46 @@ +/* +This script should be placed in the UI action on the table sys_flow_context form view. +This UI action should be marked as client. +Use runClientCode() function in the Onclick field. +*/ +function runClientCode() { + + if (confirm('Are you sure you want to Expire the Timer activity ?\n\nThis Action Cannot Be Undone!')) { + //Call the UI Action and skip the 'onclick' function + gsftSubmit(null, g_form.getFormElement(), 'ExpireTimer'); //MUST call the 'Action name' set in this UI Action + } else { + return false; + } +} + +if (typeof window == 'undefined') { + ExpireTimer(); +} + +function ExpireTimer() { + var grTrigger = new GlideRecord('sys_trigger'); + grTrigger.addQuery('name', 'flow.fire'); + grTrigger.addQuery('script', 'CONTAINS', current.sys_id); + grTrigger.addQuery('state', 0); + grTrigger.setLimit(1); + grTrigger.query(); + if (grTrigger.next()) { + var grEvent = new GlideRecord('sysevent'); + grEvent.initialize(); + grEvent.setNewGuid(); + grEvent.setValue('name', 'flow.fire'); + grEvent.setValue('queue', 'flow_engine'); + grEvent.setValue('parm1', grTrigger.getValue('job_context').toString().slice(6)); + grEvent.setValue('parm2', ''); + grEvent.setValue('instance', current.sys_id); + grEvent.setValue('table', 'sys_flow_context'); + grEvent.setValue('state', 'ready'); + grEvent.setValue('process_on', new GlideDateTime().getValue()); //aka run immediately + grEvent.insert(); + grTrigger.deleteRecord(); + gs.addInfoMessage("You have chosen to end any timers related to this flow."); + } + + + action.setRedirectURL(current); +} From f889d848d50213c77d713111a1db04c2d24dc0b3 Mon Sep 17 00:00:00 2001 From: bharakm Date: Sun, 19 Oct 2025 15:20:23 -0500 Subject: [PATCH 4/4] Create README.md --- .../UI Actions/Expire Timer in Flows/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Client-Side Components/UI Actions/Expire Timer in Flows/README.md diff --git a/Client-Side Components/UI Actions/Expire Timer in Flows/README.md b/Client-Side Components/UI Actions/Expire Timer in Flows/README.md new file mode 100644 index 0000000000..82cd52d2b6 --- /dev/null +++ b/Client-Side Components/UI Actions/Expire Timer in Flows/README.md @@ -0,0 +1,13 @@ + +This UI Action adds an admin-only button to Flow Context records in ServiceNow. It is designed to expire active timers within a flow, allowing developers and testers to bypass waiting stages during sub-production testing. This helps accelerate flow validation and debugging during development cycles, especially useful during events like Hacktoberfest. + +Flows in ServiceNow often include Wait for Condition or Wait for Duration steps that can delay testing. This UI Action provides a quick way to expire those timers, enabling the flow to proceed immediately without waiting for the configured duration or condition. +Features + +Adds a button labeled "Expire Timers" to Flow Context records. +Visible only to users with the admin role. +Executes a script to expire all active timers associated with the selected Flow Context. +Ideal for sub-production environments (e.g., development, test, or staging). +Speeds up flow development and validation. + +image