I’m building an app for parents, and would like to enable different “profiles” the parent user can use depending on the baby they want to use the app for.
I’ve managed to allow users to add, update and delete babies, and only see the babies they are linked with. However, I’d like for them to be able to “share” baby’s profiles with others, e.g. a spouse. I’ve tried everything I can think of but I can’t get parents to add other users to baby’s profiles within the app.
Notes: I have set relationships between babies and users as multiple connections both ways. I can add new parents to babies myself in the database (outside the app). I’ve tried using forms for users to type a new email address of the intended sharee, but I can’t get the form to update the baby’s record with the inputted email address, or the user (of the inputted email address) to update with a new baby.
Any ideas much appreciated! I’m pretty new to this, so apologies if this is easy!
Does the user that is to be added already exist?
The many-to-many relationship only works with existing records. So first create the user, then add them as a parent to the baby
Dilon, you’re example looks really close to what I’m trying to accomplish! So thank you! The only part that still needs solving is that I don’t want to display a list of all users (there might be hundreds). I’d rather the user type in a specific user to add them onto the list, as in my last photo above.
Any tips on getting the last step would be much appreciated! I’ll be back online this afternoon to try and figure it out based on the foundation provided in your video in any case.
I think the way that you are trying to do is not possible. Because to add existing users you need like a dropdown or a list and a toggle ( like I created ). Or you have to create new user and update that new user and add the current baby.( You can add a create user action and Update new user action and add current baby to the relationship property)
Or you have to create new user and update that new user and add the current baby.( You can add a create user action and Update new user action and add current baby to the relationship property)
Thank you once again! I didn’t want users to be able to add each other to each other’s baby profiles so easy, so was trying to avoid a drop down list or similar. I think I found a workable solution though, and thought I’d share here.
I’ve created a form for the other party (say spouse or partner) to log in (this will require them to be next to each other or happy to share login details admittedly, but I don’t know if there’s a better solution).
Following this, I can update the newly logged-on account, then log out the new user, as shown below. The original user will need to log in again, but the baby is then “shared” as intended.
So I think you’ve got the functional part of ‘adding’ covered now right?
The other part is more about inviting and accepting. Kind of like a friend invite/request.
You could set up a separate db/screen with invites which the other user must accept before being added. Alternatively you could create like an invite code that can be shared. After the receiving users inputs this code in a special screen, look up if the code exists and is valid and if so then add the baby/user.
I think both are a bit cleaner then what you designed now. But if it works for you don’t change it!
Thanks Steven. Yes, it’s working. I may yet try to improve it with an invite system as you suggested. I’m not quite sure how to build that yet, but I’ll probably come back to it after fleshing out a few other sections of the app.