On page load, redirect

I’m trying to figure out how to redirect a user based on their role on the website.

Example
I have companies and Reners. in the sign up process they become one or the other.

when they login i need bubble to redirect them to the appropriate pages based on whether they are a company or renter. right now when they log in they get brought to a loading screen, on that loading screen i have the following workflows.

When page is loaded and when current users role_company is yes navigate to ‘x’ page. If I only have this workflow then it works. but when I add the next workflow

When page is loaded and when current users role_company is no, naviage to ‘y’ page. Bubble hangs and doesn’t redirect to the correct page.

Ideas?

Can you set up two workflows for when the Login Button is clicked, instead of redirecting to a loading page? For example - "When ‘Log In’ button is clicked and Current User is “Renter”, go to --> Renter Page. And, "When ‘Log In’ button is clicked and Current User is “Company”, go to --> Company Page.

I have them going to a loading page because there are a few things that needs to happen. One is setting up their account. If its their first time logging in the ‘loading’ page will get them to finish setting up their account as the ‘create account’ part I have is strictly just setting up an email and password.

Ohh I see. :slight_smile: The workflows on the loading page should work as you need them to - can you share a link to the editor?

There’s the link. I actually noticed it stops any page redirect when I have those two situations on there. There is another redirect that if the user isn’t logged in to redirect to another page. That one is also not working now.

When I opened the Loading Page (as a non-logged in User), that workflow brought me back to the homepage (as expected). The other action you have in the workflow is:

This contains a deleted field (User Type); I think you need to replace the User Type field with the boolean fields you created on the User. Are you using the Account Created field to identify is a User’s profile is complete?

1 Like

That must be on an old page. I apologize, check out the ‘user_onboard’ page

And yes i’m using the ‘account created’ field to identify if the users profile is complete.

1 Like

I just tested with a User (had to modify some of the boolean fields in the User app data) and all of the workflows work as expected. On some of the Users, the “role_pilot” field was empty. If that’s the case, the “Do when page is loaded and Current Users “role_pilot” is [yes or no]” workflow will not run because the User doesn’t have a yes or no value in that field. I changed Evan’s fields to match what they needed to be in the workflows, and was successfully taken to the correct page each time. Which User were you logged in as?

1 Like

did you try the others? cause the others are not working. the blank field could have been a problem. but now they don’t have blank fields and i’m still seeing an issue. check all the accounts

1 Like

As Evan, I was taken to the user_history page. For the two Rose Users who have the fields completed, I’m taken to the user_aircraft page. The other Users don’t have the fields needed to meet the workflow condition. Which User was not taken to a page when you tried?

1 Like

Ok something is weird then. for Evan yes i’m taken to the user_history page as well which is correct, but for the cawingz & wingzonline accounts it just sits on a blank white page. and all the fields are filled out

1 Like

Are you using the ‘Run As’ links from this view?

1 Like

yes I am

1 Like

And this for the URL in preview mode?

1 Like

no, not sure how i’m getting there. if i click on ‘run as’ it takes me to the home page and then I click the ‘home’ button in the top right which will bring it to the user_onboard page but the URL is…

1 Like

Ohhh my apologies, I was manually entering the page before, not clicking the home button. There may be a bug here. Can you try removing the type of content from the user_onboarding page, and then remove the Data to Send: Current User from the workflow within the Home Button?

1 Like

done. I"m still seeing the issue

1 Like

I just removed debug mode from the URL, and now it works for me. Does it for you?

1 Like

awesome! yes its working. So this just a bug in bubble you think with the debug mode?

1 Like

Ok great, glad it’s working. :slight_smile: Yes, I think this is a bug with debug mode. If you can, fill out a bug report describing the issue here:

1 Like