- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 03:47 PM
Hi,
I have two catalog Item (Workflow:1 & Wokrflow:2) in order Guide. As soon as Order request is submitted, two RITM are created underneath REQ.
As per my requirement, Workflow:2 should wait till particular task is closed in Workflow:1
As per docs, I have added WAIT for WF Event and also script to generate Event but still failing.
#Workflow:1
//Generating Event in RUN SCRIPT Activity
var w = new Workflow();
w.fireEvent(current, 'Execute.Workflow.2');
#Workflow:2
#WAIT for WF Event Activity
Event is also registered in Event Registry table.
Issue: Workflow:2 never moves from WAIT for WF Activity.
Personal Instance: New York
Does, anyone have faced the issue.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 10:17 PM
Hi Kiran,
Fire event triggers the workflow event to the workflow context from current record, however I think you want to trigger the event from one RITM's workflow context to another RITM's workflow context. You need to get the running context from RITM 2 in order to trigger the event to that workflow.
You need to query RITM table to find out the RITM record to which the other workflow is associated.
Try the following code:
var ritm = new GlideRecord("sc_req_item");
ritm.addQuery("request", current.request);
ritm.addQuery("sys_id", "!=", current.sys_id);
ritm.query();
while(ritm.next()) {
var wf = new Workflow().getRunningFlows(ritm);
while(wf.next()) {
new Workflow().broadcastEvent(wf.sys_id, 'Execute.Workflow.2');
}
}
Give it a try. Hope this helps!
Cheers,
Manish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 10:17 PM
Hi Kiran,
Fire event triggers the workflow event to the workflow context from current record, however I think you want to trigger the event from one RITM's workflow context to another RITM's workflow context. You need to get the running context from RITM 2 in order to trigger the event to that workflow.
You need to query RITM table to find out the RITM record to which the other workflow is associated.
Try the following code:
var ritm = new GlideRecord("sc_req_item");
ritm.addQuery("request", current.request);
ritm.addQuery("sys_id", "!=", current.sys_id);
ritm.query();
while(ritm.next()) {
var wf = new Workflow().getRunningFlows(ritm);
while(wf.next()) {
new Workflow().broadcastEvent(wf.sys_id, 'Execute.Workflow.2');
}
}
Give it a try. Hope this helps!
Cheers,
Manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2019 09:35 AM
Thanks Manish,
Let me try this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2022 08:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 10:30 PM
Hi Kiran,
we can also go for the the subflow here.
Thanks,
vishal