How to create customer accounts for company accounts?

I’ve been struggling how to structure the database to enable companies (core users) to create accounts for their customers and enable those customers to login into a separate dashboard where they can manage their profile information.

When a customer logins into their account, they should be able to see the company that has their data and then edit as needed. I don’t know how to structure the database to enable this, I’ve tried a few things and none of them see to work.

Any guidance is appreciated!

Hi there, @deeknee… there are many ways you could structure your database, of course, but here is what comes to mind based upon the description in your post.

Even though you refer to a company as a user (core users), I can’t see why you wouldn’t want a company to be a thing, so I would very likely have a Company data type.

You will want to associate users to companies, so you could have a users field on the Company data type that is a list of users, you could have a company field on the User data type to store the company to which each user belongs, or you could have both in order to have easy access to that association from both data types.

Finally, you are going to want a way to differentiate users who can create companies and customer accounts from the customers themselves, and I would likely do that via a role field on the User data type that is tied to an option set that defines the roles. With that field in place, you can control the functionality and pages that each role can access, such as your mention of a separate dashboard for customers.

Anyway, that’s one way to go, and I hope this helps, even if it’s just food for thought.

Best…
Mike

2 Likes

Hey Mike, this is super helpful. To be honest, I have zero experience with database structures and am now learning more and more about it both inside and outside of bubble. I’m going to try and structure the DB off of your summary and see if I have more luck.

1 Like

Hey Mike just a quick one, my intention is for companies to create an account and then they can use a sign up form my platform provides to embed on their website. When customers use that sign up form on that website, it populates the companies database of customers to which the customer can then log into their on separate login area to manage their data.

Is your above recommendation adequate to meet this requirement? Just wanted to make sure I made it clear what I’m trying to achieve.

Each company won’t have its own database of customers, per se. All customers will be things in the User data type, and each customer will belong to a company through the association to a thing in the Company data type.

So, I guess the short answer is yes, I believe the structure I have proposed would work for your use case. It would just be a matter of figuring out the whole embedded sign up form thing. The bottom line is that when a customer signs up, you need some way to populate their associated company as part of the sign-up process. Once you do that, everything in the app (including your privacy rules, which will be very important in your case) will key off of that association.

1 Like

Thanks again! If I have more questions I’ll DM you, I’ve noticed you offer an hourly rate for helping so I’ll be in touch if needed.

Have a great day!

1 Like