My Business rule triggers the Event but my WF Wait for Event doesn't continue

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 05:56 PM
I have a workflow (CSM Training Request) that should wait for an external Event to be triggered. The event name is "state.resolved.changed" and is fired by a Business Rule.
The event log shows that the event is fired but the workflow is still waiting for the event.
What am I doing wrong?
I solved it! I had to use the script below in the Business Rule
var wf = new Workflow().getRunningFlows(current);
while(wf.next()) {
newWorkflow().broadcastEvent(wf.sys_id, 'state.resolved.changed');
}
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 07:49 PM
"Wait for WF Event" Workflow Activity will work only when event is fired within workflow. Refer to below notes.
The Wait for WF Event activity causes the workflow to wait at this activity until the specified event is fired from another activity in the workflow. Events from other activities are fired in a script using the workflow.fireEvent('eventName') API call.
https://docs.servicenow.com/bundle/london-servicenow-platform/page/administer/workflow-activities/reference/r_WaitForWFEvent.html
Refer to below documentation
https://docs.servicenow.com/bundle/london-servicenow-platform/page/administer/workflow-administration/reference/r_WorkflowEventSpecificFunctions.html