ServiceNow : Workflow Development

Iqbal Mohd
Servicenow Tutorial
1 min readMay 26, 2018

Wait for WF Event, fired your workflow from everywhere.

The Wait for WF Event activity causes the workflow to wait at this activity until the specified event is fired.

Use this activity to wait for another activity to fire an event. Events from other activities are fired in a script using the workflow.fireEvent(‘eventName’) API call.

Wait for WF Event vs Run Script

Run script only limited for certain time only and if the workflow doesn't reach that point, its never execute the script . But Wait for WF Event run when condition is true.

How to use it?

For example, create business rule to fired event.

function doIt(){
var gr = new GlideRecord('change_request');
gr.get(current.number);
var wf = new Workflow().getRunningFlows(gr);
while(wf.next()) {
new Workflow().broadcastEvent(wf.sys_id, 'medium.notifyWorkflow');
}
}

And simply add Wait for WF Event activity in workflow.

--

--

Iqbal Mohd
Servicenow Tutorial

Programmer - A person who fixed a problem that you don`t know you have , in a way you don`t understand. 3 years experience in programming with HSBC and SINGTEL.