How Do I Create a Run Script in a Flow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 06:28 AM
How do I create a run script in flow designer?
In the past we used workflow editor. There was this activity "run script" where we would broadcast an event to trigger an email notification.
An example of the workflow.
In the activity, we use an eventqueue that would trigger the email.
Given that workflow editor is no longer supported, we are now forced to use flow designer.
"The Workflow Editor is a legacy product to maintain existing workflows already in production. For new use cases and workflows, use the following ServiceNow applications:"
In flow designer, I am trying to create that same script to broadcast an event that will trigger an email notification.
However, there is no "run script" under the action here:
Where is the equivalent to "run script?"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 06:35 AM
You can create an action and insert the script step in it. Finally, add that action to the flow. This way it is easy to reuse the action in other flows.
Also, there are a few other places where you can write a script in flow, one of them is you can toggle the script icon and start writing one within the step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 07:44 AM
Any specific action? I created an action "Send Notification" and added my script here. Will this work?.
/*
**Access Flow/Action data using the fd_data object. Script must return a value.
**Order number is offset by +1 in Error Handling Section.
**Available options display upon pressing "." after fd_data
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/
gs.eventQueue("legal_not_approved", current, gs.getUserID(), gs.getUserName());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 08:17 AM
I can't get this to work. Is there some official documentation on this, specifically sending an event through flow designer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 08:38 AM - edited 06-20-2024 09:00 AM
I got it to fire off, but can't get it picked up by the email notification.
Here is the event:
Here is the notificaiton.