Another database question

Hi all! I have been playing around in bubble for a few weeks now and hit a snag. It feels so simple but I just can’t figure it out! I am building an app where business owners can signup and manage their customers, invoices, etc…basically a CRM but for specialized industry. Either way, I am trying to display a list of customers on a repeating group but I’m not sure how to set the database up the right way here. Many businesses can sign up, so I want to make sure that each business customer list on the repeating group shows only that business’s customers. So right now my DB has the user data type, and also Business (includes business name, logo, address, etc) and then a customer data type (includes name, address, etc). I tried linking the databases by putting “CustomerOf” set to Business in the customer data type and “Business Owner” set to User in the business data type and just can’t seem to pull it in the repeating group. Basically, in the repeating group (in English) I need “customers of the business that belong to current user”.

I hope that made SOME sense lol. It’s really driving me nuts!

First, have a database table for customers.

Then, add a field to the business table = customers (list of customers).

So then you would search for business’s customers for your repeating group.

Thanks for the quick reply!

I actually have it set up like that already, but on the repeating group, how would I set the type of content and data source so that it only shows the current user’s business customers?

Use the “business” field on customer and on user. Then in the repeating croup add a filter or condition on the search for customers. Customer’s business equals User’s Business.

That’s pretty much exactly how it should look in Bubble. :wink:

There are a couple of ways to do this but the following is probably the simplest.

On your User data type, you need a field called Business linked to your Business data type

On the Business data type, create a list field called Customers (list) linked to your Customer data type.

Should look like this

When you set up your repeating group, the content type will be Customer and your Data source will be simply stated as Current User’s Business’s Customer (list).


This kind of privacy should truly be set with the privacy rules as well so that it’s impossible for one business to see the customers for a different business. You could set the privacy rule like this.

Good luck!