Terminate workflow but it not stop process

Hello,

I use terminate workflow in sub catch

But it not stop it go to catch in main flow.
Please guide me for stop it.

Thank you.

Hi @Stef_99

i think you have used terminate workflow with in try catch block.

you can use terminate workflow in catch block based on your exception you can use.

refer the below video on how to use terminate workflow.

hope it helps!!!

@Baskar_Gurumoorthy I use terminate workflow in catch block (sub workflow)
But not stop it go to catch block (main workflow)

image

Now flow as below.

image

Please guide me for solve it.

Thank you.

Does anyone have a method to solve this case?

Thank you

Hi @Stef_99

Use terminate workflow activity in Catch block rather than Try block.

If error occurs in Try block activity it will come in Catch block and run the terminate workflow activity.

@sarvesh.b Yes, I use terminate workflow in catch block in sub flow.

image

But after terminate workflow it go to block catch in main flow

Hey @Stef_99

Yaa, So i understood your query, take a new try catch,

Main Try:
         New Try:
                Try: 
                   UploadFileSFTP
                Catch:
                   Throw Activity - New Exception
         Catch:
               In Assign Activity:
               Bool Variable = True
Main Catch:
           Message Box: "Test"

Finally of Main Try Catch:
                          If: BooleanVairable
                          Then:
                              Terminate Workflow
                          Else: 
                                 Log message = "No Error"

If any query then let me know,

Regards,
Ajay Mishra

1 Like

Instead of “Terminate Workflow” use “Return” activity
“Terminate Workflow” generates an exception that is then catched by the outer T/C block

image

Cheers

1 Like

@Ajay_Mishra in Main Catch: I have another process that I don’t go to catch.

It possible?

@J0ska I don’t find activity return as below.

image

@Stef_99 Yes using my above logic execution will not goto Main Catch!

Just try it once!

Regards,
Ajay Mishra

1 Like

You should have UiPath Robot and UiPath.System.Activities 2023.8 and above

image

1 Like

@Ajay_Mishra Now flow not go to catch main but go to try main step next after instead.

Okay, @Stef_99

Put one more If After New Try Catch Block:

Main Try:
         New Try:
                Try: 
                   UploadFileSFTP
                Catch:
                   Throw Activity - New Exception
         Catch:
               In Assign Activity:
               Bool Variable = True
         After New Try Catch Activity:
                          IfActivity: Boolean Variable = False
                          Then:
                              Throw
                          Else:
                              Blank
Main Catch:
           Message Box: "Test"

Finally of Main Try Catch:
                          If: BooleanVairable
                          Then:
                              Terminate Workflow
                          Else: 
                                 Log message = "No Error"

Regards,
Ajay Mishra

@Ajay_Mishra Boolean Variable as argument for out right?

1 Like