Directing a type of user to a page with a slug after log in

Hi there,

I’m learning bubble and I am creating my first bubble app, stuck in a section of my app and I need help.

I am building an app that has 2 user types, type ‘company’ and type ‘candidate’. When a company-type user logs in, I first add a workflow to log in the user and direct the user to the company’s page, but now I want the data that the user sees to be their company’s data. I can’t figure out a way to send the current company’s data to that page automatically. It only works if I add the user’s company’s slug in the URL, but I want this to happen automatically. The user is not supposed to type in their company’s slug manually, but rather get directed to their company’s page automatically (with the company’s slug).

You can test the app with this link: Log in | WorkForce

Help is much appreciated, Thanks in advance

Hi @yveskwameh! Welcome to Bubble

There are a couple of ways you could do this. You could:

  1. Send the company data to the page using url parameters or path segments and having the parent element search for a company with the value of the url param as a constraint
  2. Have the page/parent element to reference to the user’s company by either searching for the company or referencing to a specific company record in a field

Overall, it would depend on your data structure and if you want to use url paths (website.com/dashboard/companyUID).

Here’s a few examples of how you might do it depending on your DB structure

Hope this helps!

1 Like

Thank you @ntabs , for some reason this didn’t work. I think what I need is a way such that when a user logs in it navigates to the URL with the current user’s company’s slug. Because if a user is logged in, it navigates them to an empty company’s page where their details are available therefore there’s no company data to display. But if I add the current user’s company’s slug to the URL the company’s data shows up. I don’t know if that makes sense.

Thank you for your time @ntabs , I really appreciate it.

What I outlined above are examples on how you might structure it. It would still depend on your data structure or how you reference to the company in the url e.g. url parameters, paths, etc

Try doing this instead:

  1. Log the user in
  2. Go to page x and in the data to send field, use current user’s company’s slug
1 Like