How to terminate workflow in for each loop after all iterations if condition is not met

Hi guys,

I have this workflow where I need to iterate through a mail inbox to find a mail with a specific subject and if the condition is met it saved the attachment and processes it. However I can’t seem to wrap my head around how I stop the workflow if no mails with the subject is found.

If a put a terminate workflow or similar activity in the else box of the if statement it will do this on every e-mail in the loop. I need the workflow to stop only when it has gone through all mails in the loop and condition is not met.

How would I do this easiest?

Thanks.

1 Like

Fine
got it
now use a assign activity in the ELSE part with a boolean variable in the left side like thi
bool_nomail = True
where bool_nomail is boolean variable
and in the THEN part atlast use a assign activity and mention like this
bool_nomail = False

so next to the for each loop use a IF condition like this
bool_nomail = True

if true it will get into THEN part where we can use TERMINATE WORKFLOW activity @stch

Cheers

@Palaniyappan, I thought of that, but I does not stop the workflow from going to the next sequence that comes after this. I need the whole workflow to be stopped if no mails are found.

1 Like

i changed my last comment
kindly have a view on that pls
@stch

Yes, that will do the trick.

Thanks @Palaniyappan.

Cheers @stch

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.