How Do I Create a Run Script in a Flow

dmullinax
Mega Guru

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.
workflow.jpg

In the activity, we use an eventqueue that would trigger the email.
run_script_eventqueue.jpg

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:

flow.jpg

Where is the equivalent to "run script?"

4 REPLIES 4

Muralidharan BS
Mega Sage
Mega Sage

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.

 

 

 

Any specific action?  I created an action "Send Notification" and added my script here.  Will this work?
script_001.jpg.

/*
**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());

dmullinax
Mega Guru

I can't get this to work.  Is there some official documentation on this, specifically sending an event through flow designer?

dmullinax
Mega Guru

I got it to fire off, but can't get it picked up by the email notification.

Here is the event:

event.jpg

Here is the notificaiton.

notification_001.jpgnotification_002.jpg