How to remove item from a list inside its own for loop?

Hi All

I have a list of emails which i am looping using For Each loop. I am doing some operations using the property of each email and finally adding it into queue.

Let say out of 10 items 5 are added and in the 6th item some exception occurred then it comes out of the loop closes al applications reopens and then again enters the For loop again, so the older items again gets executed.

How can I prevent it ?

1 Like

Hey @kkpatel

  • Mark the emails as read to keep track

  • Use a try catch to just bypass failed ones only for the loop body

Any of this should help


1 Like

Hi @kkpatel

Keep all the code from For Each loop within a try-catch block

Hope this will help you…


As @Nithinkrishna said. use Try catch activity inside the catch use continue activity so even if the business exception or system exception occurs this will continue from the next item


1 Like