Hello guys,
I am currently developing an app where I need to assign multiple responsible parties (‘responsaveis’) to a student record. Each responsible party is a document in a Firestore collection, and the student document should have a list of references to these responsible party documents.
Here’s where I am facing challenges:
I create a responsible party document in the ‘responsaveis’ collection using the ‘Backend Call Create Document’ action. This part works fine, and Firestore generates a unique ID for each new document.
The issue arises when I try to add this newly created document reference to a local state variable (i've tried with a app state variable, but is the same) that is a list type designed to hold document references (
dadosResponsavel
).I am unclear on how to update the local component state with the document reference ID from the newly created responsible party record. I expected to use the output variable from the document creation action but am struggling with the correct way to do this.
Lastly, I need to use this list of document references when creating a new document in the ‘alunos’ (students) collection, specifically setting it to the ‘responsaveis’ field which is of type
List<DocumentReference>
.
Here’s an outline of my actions:
Create Document Action: Backend call to create a document in the ‘responsaveis’ collection.
Action Output Variable Name: Set as
responsavel
for the reference ID.Update Component State: Trying to add
responsavel
to thedadosResponsavel
list.
And the crux of my problem:
How can I properly assign the document reference ID from the ‘responsaveis’ creation action to the
dadosResponsavel
state list?
I am attaching screenshots that show my current action setup for clarity.
Could anyone advise on the correct method to achieve this in FlutterFlow, or point out what I might be missing?
Any insights or guidance would be greatly appreciated. Thank you for your time!