Hello, total newbie at Bubble. I watched some tutorials but would like to know if I am in the right direction.
I am building an app for contractors that have clients.
There is a default datatype “user”. Which user is this in my case? The contractor or the client? Or should I make two new datatypes and ignore the existing “user”?
Second question: the contractor should create accounts for the clients. I have tried that by making a button and a workflow for this button to create an account for the entered e-mail adres. Is there something else I should do? When I enter an email address, I don’t receive an e-mail. Did I forget something? Or doesn’t this function in preview mode?
Everyone would be a user, because everyone needs to be able to login.
Sounds like you do need a Contractor datatype, but think about your data structure because could multiple Users needs to be associated with a single Contractor?
And could multiple Users need to be associated with a single Client?
The Create an account for someone else action works, check in the Data tab, then the Users table and at least see if it was created. The email probably got sent but not delivered because the built-in free email sometimes has deliverability issues.
Wow, thanks for the mega fast respons.
Yes, a contractor will have several clients. What does that mean for the data structure?
If both parties are users, how should I distinguish them?
There are a few ways to do it depending on how flexible you want the system to be.
If you make an option set with options for Client and Contractor, then you add a new field called Type under User and make it the option set. So you can set a User’s Type to either Client or Contractor.
Then when they login you direct them to either a contractor or client page depending on their type.
The structure kind of depends on how detailed you want the system to be, should there be a Job datatype so you can store payment logs or pictures for that job specifically, is it just one Contractor for a Job? Multiple users for one Client? One client per job or multiple? The list never ends
I’ve been dealing with this same issue for a while now. When a new “Contractor user” creates an account with us they get tagged with an “account-id.” That account-id links everything that user does, including onboarding an employe user, customer user, vendor user etc etc. The problem I’ve been having is having that account-id track through using bubble’s workflow “create an account for someone else.” I’ve always had manually add that account number manually. I need to figure this out before I can’t keep up anymore.
The issue is somewhere in the “create an account for someone else workflow?” Bubble sends out the invitation but, for some reason, when that user logs-in that account-id doesn’t follow them? Without an account-id the user can login but can’t access anything or see much of anything. That’s because everything is linked to an account-id.
I’ll step back: When a new user creates an account with our app, they get tagged with a new data type called account-id. That id gets tagged to everything they do create etc. As such, when they invite a new user to join account that account-id is supposed to attach to them. The problem may lie in the order of operations? But I’ve worked through several iterations but nothing, thus far, seems to work?
You may be right on that… Every data type I create starts with a link to account-id. It wasn’t my idea, but it made sense… And, seemed like a good way to overcome the challenge of multi-tenancy.
When you reference Current User's < Account user link you are pointing to the current user, not the newly created user… is that on purpose the way you have it? That would set the new user’s link to the same as the Current User. If that is what you are trying to do, is that field not filling in or something or what exactly is the issue?
Then what is the second screenshot doing? Is the Account datatype the same as that “< Account user link” field type? You are searching for multiple Accounts? Each of them adding the new user to the list?
I’m going to get back to you on this… I’m going to run a test so as to refresh my understanding of the problem. I realize that I may not be doing a good job in explaining the problem.
I apologies for the delay. I’ve stumbled onto some success with the workflow. Step 1. Sign the user up. Step 2. Create an account for someone else. Step 3. Add result of step 2 to a list ( data type account. Step 4. Log the user out.
I was testing several iterations and the one that logged the current user out worked. So I just stopped there. But I’m not sure what about logging the current user out makes this work?
All the data types were created in the data base on my end. But for some unknown reason when that particular user would login it wouldn’t associate the < account user link to the user account that created it. For some reason logging the user that creates the new user out before that new user can login somehow solidifies the connection? Again, I have no code experience so, my ability to explain/describe what’s going on is somewhat limited.
You were right @tylerboodman in some cases privacy rules were an issue. Tho not ideal the current method ( logging the current user out ) seems to be working… I need to keep moving forward so I’m going to have to pivot away from this for now. Thanks again for all the help.