How to use the Continue activity

Is there any sample workflow of using the Continue activity in for each loop? I have a for each loop and want to skip to next item when exception occurs. Is it suitable to use Continue in this case? Will the Global Exception Handler be able to catch the exception if I use Continue? Thanks.

Hi @YY.Hui

Global Exception Handler will be able to catch the exception if you use it for sure. It is applied for the entire solution. However, I don’t think that has the capability to mention that you have to skip the next activity in the for each and get out of it and execute the activity after the for each. It will only catch the exception. However, it has the continue capability. But it will execute the right next activity without skipping anything.

So, if you want to skip the next activity in the loop and get out of the loop in case of an error, the best option is to use a Try Catch within the for each loop. Under the Try segment, have all your activities listed. In the Catch section, Have your continue activity.

Let’s assume you have two activities in the Try, and first ended up in an error, Then having the continue in the Catch section enables you to skip the execution of the next activity and get out of the loop.

1 Like

Hi @YY.Hui,

Welcome back to the Community.

If you need to continue on exception, you need to use try catch. If you want to skip the loop based on some condition, you can use “Continue”. Please find the below example.

3 Likes

Thank you gentlemen.

I added Try/Catch in my workflow and it works smoothly.

Thanks!! :+1::+1::+1::+1:

1 Like