Run step only if step 1 was successful

Is there any way to only run a step of a workflow if another step is successful? I want Bubble to only send an e-mail to a new user.

Step 1 only runs if a user has an existing account, step 2 is creating the account if not, step 3 sends an email to the new user if created in step 2. The thing is, how can I setup that it only sends an email to a new user?

Thanks!

You can create a Custom Event that triggers only if Current User is not logged in. Put step 2 and 3 inside it.

The current user is not the user mentioned in the steps. Do you have any other suggestion?

Ah, ok, I just assumed that was how you checked if he had an account or not. How about this:

Step…
1: Run only if user has an account
2: Terminate workflow, only is user has an account
3: Create account
4: Send mail

1 Like

I do something similar to the following:

Create a field in the User data type called ‘New User’ with the type ‘Yes/No’. Make it default to ‘yes’.

Now create a new event for when the user logs in and set it to run only when the ‘New User’ field is ‘yes’.
Now step one is to send an email and step 2 is used to set the ‘New User’ field to ‘No’


Hope this helps…

Some of the other solutions are more general and could probably work for lots of different scenarios where you want a given Step to only run sometimes, but, given that you specifically mentioned creating a user and sending an email, there is a much simpler way.

Step 1 - does whatever it does (you didn’t explain what it was doing)
Step 2 - creates a user by way of the “create an account for someone else” action, correct?
Step 3 - just use the “send email” action and set the “To” property to be the dynamic value of “Result of Step 2 (Create an account for someone else)'s email”

If Step 2 never happened, there will be no value in the Result’s email, so the send email action will fail. You can also set the “Only When” property of the Send Email action to be “Result of Step 2 (Create an account for someone else)'s email is not empty” if you dislike the idea of failing via error.

Marc

1 Like

I also thought this will work, but unfortunately not. The “Result of Step 2 (Create an account for someone else)'s email” does have a value. The “only when” is preventing saving this value to the database, but it does have a value.

This topic was automatically closed after 70 days. New replies are no longer allowed.