Teagshep
Teagshep6mo ago

Use request body

This must be a super basic question, but i cant seem to figure it out. How do I use the value that i get from the previous node "Get request body" (i am trying to grab user_id) and pass it into the node Get Firestore Document with User ID as value user_id from previous node?
No description
1 Reply
AI Support
AI Support6mo ago
Passing Values Between Nodes in BuildShip To pass the value of user_id from the "Get Request Body" node to the "Get Firestore Document" node, follow these steps: 1. Get Request Body Node: Ensure this node is correctly set up to retrieve the user_id from the request body. The user_id should be stored in a variable. 2. Variable Reference: Note the variable name where user_id is stored. Let's assume it's stored in a variable named user_id. 3. Get Firestore Document Node: - Edit the "Get Firestore Document" node. - In the input field for the document path or ID, reference the user_id variable from the previous node. - Use the syntax ctx["root"]["previous_node_id"]["variable_name"] to reference the variable. Replace previous_node_id with the actual ID of the "Get Request Body" node and variable_name with user_id. Example:
{
"documentPath": "users/${ctx['root']['previous_node_id']['user_id']}"
}

{
"documentPath": "users/${ctx['root']['previous_node_id']['user_id']}"
}

4. Testing: Test the workflow to ensure that the user_id is correctly passed and used to retrieve the Firestore document. If you encounter any issues or need further assistance, please let us know, and our s