How to Handle Conditional Actions for Login/Signup and Create a Record After Submission?

I have a simple task but I’m struggling with handling conditional workflows for login and signup. Here’s the scenario:

On my page, I have a form, and when the user clicks “Submit,” I need to handle the following three cases:

  1. If the user is already logged in: I create a record and redirect them to a specific page (This part is working fine).
  2. If the user is not logged in and clicks “Login”: I show a login form. Once the user logs in successfully, I need to create the record and then redirect them to the specific page. However, I’m not sure how to ensure the record is created after the login action and then handle the redirect properly.
  3. If the user is not logged in and chooses to register: I show a popup for registration. After the first step of registration (e.g., entering an email/password), they proceed to the second step (e.g., filling out additional profile details). Once registration is completed, I need to create the record and redirect them to the specific page.

I’ve set up the workflows for creating records and redirection, but I’m having trouble chaining the actions correctly when login or signup is involved. Specifically:

  • How do I ensure the record is created immediately after login or signup (and only if successful)?
  • How can I handle multi-step registration while maintaining the flow to create the record and redirect after completion?

Any tips, best practices, or workflow examples would be greatly appreciated! Thanks in advance!

I tried this, and after sign up I add action, but pass immediately so we don’t wait when user login/signup or if I set ‘only when user is logined’ it never happens.

I try to keep things as simple as possible. So having said that…

why not just have them login before they fill out the form?

You could have conditionals or whatever that redirects them to the login page. When they login you then have a workflow that takes them to the previous page.

Simple and doesn’t involve a lot of complicated maneuvering.

hi @prosto.duda
create a custom workflow, put the create record action and redirect action inside the custom workflow.
Ensure to trigger the custom workflow after the “log in the user” action or “sign up the user” action.
“Current user” expression would also correctly reference the just logged in or registered user, incase you need it in the record you are creating.

My theory is ‘don’t confuse effort with results’.

So, I’m curious why you would expend the extra workflows if you could just have them login first?

@prosto.duda my initial comment didn’t notice that you are calling the action “Trigger signup from popup_signup/login A”, I thought you were using the “log the user in” or “sign up the user up” action. Please trace out that custom workflow “Trigger signup from popup_signup/login A” till the very end and ensure that that workflow does not have a “go to” action inside of it, because I think that custom workflow is linked to another workflow.

@senecadatabase I think @prosto.duda would be able to explain why he is doing that. I know there are usually different reasons for different UX.

They come to LP and already put data, I don’t want to loose data

I use the existing template ‘canvas’ so I just try to use exist template features. Yes they have go to workflow, so look like it is better for me just duplicate it, but how correct way to finish this singup/login workflow, should I create custom event? But how catch this event in initial page?

Or I can modify it and pass some new parameter to prevent ‘go to’ workflow.

Not sure what is more correct.

p.s I’m a software engineer. I try to stop think like regular developemnt, but now it is hard. Usually we have full control.

Okay, does the go to action redirect you to the index page?
if the “go to” action goes to the index page, then all your follow up action should be in the index page. That is, the creation of the search request and the go to my_search_request redirection. All should be in the index page.
So that the user would be further redirected from there.
But I am abit skeptical that login from popup would direct you to the index page because I am familiar with the workflows in the cavas.

Now it more clear for me. 1. after user loggined the component call ‘login 3 complete’ event. 2. the ‘login 3 complete’ event has redirect to index and close popup.


so I think if I can just add ‘condition’ to go to index it will save my flow?

yes, you’re correct @prosto.duda you can add a condition to prevent go to index page if the current page name is not login. or any expression you see fit.

Unfortunately, I can’t see a way to catch an event from a child component.
Let me explain my case, I have page A, this page has singup/login popup component, and this popup contain real signup/login component. structure → page → popup → component. The compoenent have event ‘login 3 complete’, but I have no idea how to catch this event from the page where I use this component.
Again. I have one workflow to trigger event in child


but how catch event from child in parent?

@prosto.duda I guess you think you need to catch the event in the child component, so as to know when to trigger the create and redirect action in the parent page, right?
If that is what you have in mind, then I don’t think that is how bubble works in this very case. once the child component finish running, it comes back to the parent component to run the remaining action that have been listed. But you just have to ensure that the child component does not have a go to action inside it, because this can disrupt the flow. So just add that condition to prevent go to index page if the “current page name is not login”

But if this is not why you need to catch an event from a child component, let me know why you need to catch an event from a child component, we could use state or run javascript to catch an event from a child component.

PS: child compnent is usually called reusable element in bubble.

Thanks for spending time on me. This screen shows how popup appear, but after this, immediately fire the next event to create a record, but we are not login yet.

okay @prosto.duda I think I understand better now.
First let me say @senecadatabase suggestion would have been best. force them to login once the user tries to access the form (before the even begin filling the form). But if for some genuine reason, you still want to stick to your method, here is what you can do

Create 2 event when the user clicks on sumbit:

  1. event when user clicks on submit & current user is logged in - here you would just create and redirect.
  2. event when user clicks on submit & current user is not logged in -
    a. Create different state on the signup/login component (each state would take the form input value) - that would transfer those values inside the signup/login flow
    b. ensure that the submit button is unclickable unless the user fills all the form completely
    c. when the login flow is complete, check (still inside the signup/login component) if all those values are not empty, if not, then trigger a custom event inside the signup/login component (create a custom event that has 2 actions. i.) creates the record from the signup/login component states and ii.) redirects the user. )

This should solve it for you.

sorry, I can’t do this. login resuable component should now nothing about where we trigger it. It is break single responsibility rule. I just want login show to main page “user is login, you can continue”

then split the responsibility in the UX by making them login before they fill the form.

thanks for time. I just use custom state ‘just logged in’. I little bit strange, so I added the custom to sign/login resuable component, added same custom state to sign/login popup resuable component, added workflow "only when the custom state of sign/login RC is 1’ we set 1 to sign/login popup RC, and after one work flow to main page to catch this event(state is 1). So now I have what I want.

p.s but still strange why bubble doesn’t have watch to resubale component event feature.

1 Like

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