cancel
Showing results for 
Search instead for 
Did you mean: 

Fork with two parallel branches, one necessary branch with no waiting for another branch

Harsh9
Participant
0 Kudos

Hello Experts,

I have been brainstorming in one of the customer system on one issue. Requirement is as below:

1. There is a loop.

2. Inside loop, fork with two parallel branches and one necessary branch(as of now) is being used. One branch triggers sub workflow which creates dialog step for user and other branch waits for an event to occur.

Here requirement is, if suitable event occurs OR that dialog stop gets completed, workflow execution should progress. Also if any one of them occurs, other branch should not be forcefully terminated.

I am quite unsure whether this is possible or not. Please help out.

Regards,

Harsh

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member185167
Active Contributor
0 Kudos

Hello,

Execution can't continue after a fork until it (the fork) is completed so you will need to find another way to do this.

Or maybe you could put the rest of the loop in a sub-workflow and call it in both sides of the fork.

I'm struggling to think of an example where you would want to do this. What is your scenario? Why keep waiting for that event?

regards

Rick

Harsh9
Participant
0 Kudos

Hi Rick,

I have provided detailing of what actually is required to be done to meet the requirement just above to Ronen. Could you please have a look?

Best Regards,

Harsh

ronen_weisz
Active Contributor
0 Kudos

"if suitable event occurs OR that dialog stop gets completed, workflow execution should progress." this usually means that the other branch of the fork ends and the workflow continues. If not, how should the workflow progress? what should happen next?

Harsh9
Participant
0 Kudos

Hi Ronen,

I want workflow to continue execution in both the branches, some sort of parallel processing. To meet the requirement here, I have developed as per below schematic:

Loop

     Task - Determines next course and evaluates next ID from some dynamic structure

          |

          |

     Fork 2 branches

         /\

        /  \

     B1 B2


     Branch 1 - Waits for an event which marks change in the dynamic structure


     Branch 2 - Calls sub workflow passing evaluated ID from the above task

     (Sub workflow creates dialog step for determined agent and other processing happens      further)

End Loop

Here, as per use case, once sub workflow is called and after dialog step is created for determined agent, structure could change dynamically and that will raise an event for which Branch 1 is awaiting. Thus, as soon as the event marks the change in structure, execution should continue from branch 1 point onward and iterate loop further (for dynamically changes structure). However, at the same time, branch 2 execution should continue in normal fashion. Currently, everything is working as per I described, except branch 2 is forcefully being discontinued which is leading to logical deletion of work item (dialog step for the agent).

Best Regards,

Harsh

former_member201570
Active Participant
0 Kudos

Hi,

Unable to understand your scenario in full swing , however if you make as two branches are necessary , the issue will resolve ?

regards,

shamsu

Harsh9
Participant
0 Kudos

Hi,

Good point.

However, I already applied it. Issue then would be execution of workflow will not continue to iterate next loop entry, in case where event will be triggered (Branch 1), which should actually be the case. Instead, it will wait for completion of execution of sub workflow (Branch 2) - which is awaiting for the agent to take action on the dialog step.

Here, I want both branches to continue its respective execution.

Best Regards,

Harsh

former_member185167
Active Contributor
0 Kudos

How about in B2, instead of calling the sub-workflow, you instead create an event which starts the sub-workflow?

If you then want to wait for the event then you make it 2-from-2. If not then 1-from2.

Harsh9
Participant
0 Kudos

Hi Rick,

Thank you for your response.

It would not fit in our use case. Case here is, event for which B1 is waiting will occur only after sub workflow has been triggered. Until and unless sub workflow is not triggered, event will not be triggered.

I hope we are on same page. Is there any way to build mechanism which will allow parallel execution?

Best Regards,

Harsh

former_member185167
Active Contributor
0 Kudos

There's always a way.

"It would not fit in our use case. Case here is, event for which B1 is waiting will occur only after sub workflow has been triggered."


So what's the problem?

Harsh9
Participant
0 Kudos

Appreciate that

Here, you are suggesting to wait for an "event" to trigger sub workflow (B2). Could you specify which event?

In B1, it is waiting for an "event" which would occur somewhere in timeline, only after sub workflow has been triggered.

Best Regards,

Harsh

former_member185167
Active Contributor
0 Kudos

You can add a custom event. There's a step for creating events in workflow.

Harsh9
Participant
0 Kudos

Adding a custom event to trigger sub workflow is fine. However, how would it make a difference? Please explain.

Because, (I repeat) only after sub workflow has been triggered, that "event" might occur, if at all, for which B1 is waiting.

Best Regards,

Harsh

former_member185167
Active Contributor
0 Kudos

Hello,

It makes a difference in that when the event is received the other workflow will keep running instead of being killed off when the fork terminates.

regards

Rick

pokrakam
Active Contributor
0 Kudos

I'm still not 100% with what you are trying to accomplish, but it seems your solution would be one of two things:

- 2 of 2 fork

- asynchronous start of your subworkflow

Harsh9
Participant
0 Kudos

Sorry to say but I still can't understand how by adding event for sub workflow would achieve our requirement.

Best Regards,

Harsh

Harsh9
Participant
0 Kudos

Hello Mike,

To put it in simple words, it is something which is dealing with dynamic level of approvals (could be parallel or sequential). Thank you for your suggestions. Second suggestion appears seemingly helpful here. I would explore asynchronous start of workflow technique to see if it could solve my problem.

Best Regards,

Harsh

pokrakam
Active Contributor
0 Kudos

This is exactly what Rick suggested - using an event to start the approval in a separate workflow.

former_member186746
Active Contributor
0 Kudos

Hi,

I think I have the solution.

If this is the requirement.

There is a parallel processing of 2 scenarios. Let's call the whole scenario A

B1 waits for an event which would redetermine approval.

B2 is the approval.

When B2 is finished B1 should be logically deleted, a check for the loop is made and if false the parallel processing begins again (A).

When B1 is finished you want B2 to remain in its state, waiting for approval and also you want to start A again. When B2 is finished it will not effect the newly started A. Unless I'm guessing the condition for the loop is met. Is this correct?

What you can do is the following.

No loop.

Fork 1:2

In branch 1 wait for custom event which should terminate the flow

in branch2 a subflow S1

Subflow consists of determining approval and then a 1:2 fork

B3 and B4

B3 is wait for event on changes, if branch is met then next step is calling its own subflow recursively S1

B4 is the approval, after approval a check is made to see if the approval is done, if so fire an event which should terminate the entire process. if not call the flow recursively S1.

I hope this concurs to your requirement.

Kind regards, Rob Dielemans

Harsh9
Participant
0 Kudos

Hi Rob,

Appreciate your response.

However, here branch B1 is not waiting for an event which would redetermine approval. Instead, it is waiting for an event which would indicate to continue loop further while the execution of sub workflow - branch 2, could be in state, ongoing or finished.

Best Regards,

Harsh

former_member186746
Active Contributor
0 Kudos

Hi,

That's what I meant with my scenario.

Instead of using a loop you use recursive workflows and additionally you use a separate (yet to be developed) event to control when the entire workflow is completed.

Kind regards,