Using Parallel to handle an "already logged in, so log out then log back in" situation

I generally prefer to make sure my automations log in with the user I expect them to log in with. So if it opens an app and is already logged in, I want it to log out then log back in.

With Parallel, this is very simple:

Set the timeout on both Check App State activities to the same.

  • Check App State - Login page appeared:

The key there is the Assign at the end. To make it exit the Parallel and continue, you put a boolean variable in the Parallel’s condition:

image

Then set it to True:

image

This forces the Parallel to exit, even if other branches haven’t completed.

  • Check App State - Already logged in:

Look for the profile button to confirm that it’s already logged in, then click the profile and then Log Off. Then click Log On to get back to the login page.

Now this login process is wonderfully efficient. Rather than waiting 30 seconds to see if it’s already logged in, then logging off…it just does the right thing immediately depending on which screen it ends up on - the login screen or already logged in.

After the Parallel, another Check App State to make sure we are logged in and good to go:

And that’s it, a beautifully efficient login process.