Stop Further Execution The Workflow File

What I am Doing
I have around 5 workflow sequence files. I invoke all of then in the main workflow file.

What I want to do
I want to terminate the 2nd workflow further execution if its meets the given condition. Not the whole workflow ( remaining 3,4,5 files )

What is the issue
I can not use ‘break activity’, because its only for foreach loop.
I used 'terminate activity.’ … But terminate activity stop the whole process & not excute remaining 3,4,5 workflows. Also its throw a message in pop.

I want to stop only 2nd workflow. and want to move to 3rd workflow without any popup message.

Guys please suggest me any best method.

Screenshot of main.xaml

image

Screenshot of 2nd xaml
image

@Tech_Guru

Keep that Invoke WorkFlow activity in Try Catch block then if any exception occurs it will stop executing that activity and will move to next Invoke WorkFlow activity.

2 Likes

@lakshman Thanks dear, Can we also get passed arguments from 2nd workflow to the main workflow even we are terminating it in middle?

1 Like

@Tech_Guru

If any exception occurs then Arguments won’t pass any output to other workflows.

For this you have to throw required message using Throw activity and catch that exception in corresponding Catch block like

       exception.Message.Tostring
5 Likes

if you want to pass any data along with exception use

exception.Data(“name”)=value

2 Likes

@Sreelatha278 @lakshman

Thanks, seems this is possible to get what I want in your way. But this is not the best way…Also I want to tell you that your way is to handle errors & exceptions.

But in my case this is not an error. I am working in 2nd workflow to find something ( looking for a value of a variable) If a value found in middle of a workflow. You know to further execute remaining activities is just a waste of time.

Once the value found then terminate the workflow… and send its value back to main.xaml

But as @Sreelatha278 said we can get value in exception.Data(“name”)=value but what if the workflow is not terminated in middle. I mean if value will be found at the end of the 2nd workflow ? it will not throw exception. So in this case I have to add 2 activies in main workflow. one will check if exception thrown then get variable value. and second activies to check if 2nd workflow executed complete then look for value in arguments.

UiPath developers should an option for such requirement to terminate workflow in the middle without any error & pass value to main workflow.

1 Like

you are can use flow decision/If condition then do nothing in true condition so that it won’t execute remaining activities and add the remaining activities at false condition.

1 Like

@Tech_Guru

You have to design the flow like that as @Sreelatha278 said. You have to use decision activities and all if you don’t want to perform remaining activities once you get the required value.

1 Like

@Sreelatha278, Yes Flow decision is right to do if activities is in vertical sequence.

I am using parallel activities.

Like… I have 20 activities. All are started to look for value … same time using parallel activities option. If any of 20 activity able to find desired value ? Stop the 2nd workflow.

So flow decision not work here.

image

What I am doing exactly ?

I am developing a whats app bot. which can read incoming whats app message & then using NLP it will auto reply to incoming message. My software can read & reply to any kind of whats app message.

Now I want to further expand the software. And want to add the bulk messaging feature. Or a feature where we can automatically follow up the candidates later if required in any case. ( mostly require in sales & marketing)

90% part of my software is done.

I am currently on the step where my software wants to determine whether the given number is registered on whats app or not. If registered? send the message. If not? logs it in excel.

This activity successfully working. But its taking time. So I am trying to execute it in the parallel activity. I am not sure. But I think parallel activity will run both activities ( 1. check if the number is registered on what’s app. 2 send whats app message ) these both activity at the same time which is present inside the parallel block.

If “send what’s app message” activity is executed ? terminate the workflow & not wait to complete another activity "is number registered on what’s app"

If “is number registered on what’s app” found that number is not registered ? then no need to excute " send what’s app message" activity

@Tech_Guru, I have a similar requirement where i have to invoke multiple workflow’s within a main workflow. If an error occurs in one of the workflow, it should go to the next one instead of terminating the workflow. How did you achieve that? I used Terminate but the control is coming out of Main process, which i don’t want. Please guide me. Thanks in advance.