Need to cancel wait for message in do the following in parallel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Below is my requirement ,can you please suggest .
1.In flow designer i have used "do the following in parallel" and used 2 wait for message .
2.Wait for message is waiting for event to trigger .
3.If any one of "Wait for message" action is processed i need to cancel another "wait for message " and follow further steps.
Is it possible this case ?any suggestions ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Rajyalakshmi ,
Share the Screenshots.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Rajyalakshmi ,
The standard Do the following in parallel block will stay frozen until both actions finish, so we need to bypass or satisfy the losing branch dynamically.
Because you cannot explicitly cancel a parallel branch in Flow Designer natively once it starts waiting.
From where are you receiving the messages after triggering, Inbound Email or API call's ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @yashkamde ,
Thank you for update.
Messages are receiving from API.
sn_fd.FlowAPI.sendMessage(flowContextId, wfEvent, payload);
in my case ,both branches are using "Wait for Message " ,if any one of branch "Wait for Message " completed i am closing my sctask ,ritm ,req .
But flow got stuck in waiting because another "Wait for Message " is still in waiting state.
any help to bypass branch dynamically ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I would suggest, wherever you call sendMessage for the winning event, immediately send the other message to the same flow context as well. That releases the losing branch, the parallel block completes, and the flow continues.
var flowContextId = current.getValue('flow_context_id'); // however you store
// Real event received
sn_fd.FlowAPI.sendMessage(flowContextId, 'EVENT_A', payload);
// Release the other branch so the parallel block can finish
sn_fd.FlowAPI.sendMessage(flowContextId, 'EVENT_B', { cancelled: true });
after that you can add an If condition right after the wait that checks the payload (for ex. cancelled == true). If it is a dummy release, skip the branch’s logic.
If my response helped mark as helpful and accept the solution.