Finish parallel activity on completion of one branch

Hey all,
I’m trying to solve what seemed to me to be a simple problem, but oh boy is it giving me a headache. I’m trying to build a simple loop that checks an outlook inbox. On incoming mail, it checks the subject for a keyword. If found, it exits de loop and does something with that mail. That part’s easy and solved.
To have that running (as a local robot) in the background, I’m adding a parallel activity with a system keypress event. On keypress, the flow asks if you want to quit and if you do, exits the flow. That part, also solved.
Here’s the problem that’s driving me bonkers:
If a mail with said keyword is found, the flow should pass on the list to do some processing in later parts of the flow, but here’s the rub. Since in parallel all activities need to be closed to move on, it never exits. it finishes the loop, then sits there patiently waiting for the keypress trigger to be activated.
My question is specifically: How do I tell the monitor event activity inside the parallel activity to stop listening if the second parallel activity finished?

PD: I’ve tried pick and pick branch, doesn’t work. It goes sequentially and either waits for the trigger event in the monitor event to happen or, if the loop flow is placed first, never actually gets to the monitor event.

Any help is inmensely appreciated, since this type of situation looks like one that’s often necessary to be solved.

Cheers
Stratum

Edit: Adding xaml for inspection

Main.xaml (36.5 KB)

3 Likes

Ok, proving that you should check things through before crying for help. Parallel has a CompletionCondition that you set to True to end the Activity.
Sorry bout that, lads

Cheers
Stratum

7 Likes