Create document with data from 2 firestore collections

Database & APIs

Hello guys, I'm stuck on this for 4 days already so any push in the right direction would be much appreciated. I'm making an app for an apartment cleaning business.

I have 3 collections: user collection, apartment collection and assigment collection (which contains both a doc ref to user and apartment collection).

Now I want a button ("Complete") on my admin page to create a document in the assignment collection (basically assigning apartments to a specific user to clean).

I tried to tackle this by making a dropdown menu (with a backend query of the user collection) to select the user first. On the bottom of my page I have a listview of the apartments with a button that adds the apartment to a selectedApartments state variable. In the middle I have a listview that shows the selected apartments. I tried to make the button create a document in the assignments collection with the userId being widget state of the dropdown & the apartmentsIds getting the value of the selectedApartments state variable. Yet I am completely stuck...

What have you tried so far?

FF community, google, youtube, chatgpt

Did you check FlutterFlow's Documentation for this topic?
Yes
4 replies