Ryan A
Ryan A6mo ago

Get path/ref from field value?!?

I am trying to update a firestore document based on a path from a reference field in another table and getting errors. e.g. Table1 has a ref field 'parent' ("parent/12314123123231") - I want to pass that into the [Firestore Update Document] node to update the associated document (path) in Table2 ("parent/12314123123231"). Tried variations like this (with + without the "ref" element)... but getting errors?!? ...see attached. Any ideas?
No description
No description
No description
Solution:
@Ryan A, can you give this workflow a try. As a temporary workaround I added a utility node at the top of your workflow for extracting document references from the Rowy row. However, I'm not too sure what you're trying to update in the "Update Document" node, so that may still be off.
Jump to solution
20 Replies
AI Support
AI Support6mo ago
To update a Firestore document based on a path from a reference field in another table, you can follow these steps: 1. Retrieve the Reference Field: First, you need to retrieve the reference field from Table1. Use a Get Document or Collection Query node to get the document containing the reference field. 2. Extract the Path: Extract the path from the reference field. Ensure that the reference field is in the correct format, such as "parent/12314123123231". 3. Update the Document: Use the Update Document node to update the document in Table2. Pass the extracted path as the document path. Here is a general outline of the steps: 1. Get Document from Table1: - Use a Get Document node to retrieve the document from Table1. - Extract the reference field (e.g., "parent/12314123123231"). 2. Update Document in Table2: - Use the Update Document node. - Set the Document Path to the extracted reference field. - Provide the necessary fields and values to update. For more detailed information on using Firestore nodes, please refer to the BuildShip Firestore Integration Documentation. If you continue to experience errors, please submit your issue via the in-app support button for further assistance.
Luis
Luis6mo ago
Hi @Ryan A, seems you may not be passing the reference in the correct structure. Here you can see how I'm doing it, even though I'm using the create document node it should be the same for the firestore update document node.
AI Support
AI Support6mo ago
Hi, It seems like you're having an issue with passing the reference in the correct structure for the Firestore update document node. For detailed guidance on how to structure your references correctly, you can refer to the BuildShip Documentation on Firestore Integration. If you need further assistance, please submit your query via the in-app support button.
Ryan A
Ryan AOP6mo ago
Thank you @Luis. However, it looks like you're hardcoding the ref - I need to pass the reference in as the target Document ID/Path and can't work out how to dynamically pass, adding the "_ref:" prefix inline? See my screenshot where I tried "_ref:" + (x)row.pollId - but same error. Any ideas?
AI Support
AI Support6mo ago
To dynamically pass the reference in BuildShip, you need to ensure that the reference path is correctly formatted and concatenated. It looks like you're trying to create a reference to a document dynamically. In BuildShip, you can use the Expression Editor to construct dynamic paths. Instead of hardcoding the reference, you can use the following approach: 1. Open the Expression Editor for the field where you need to pass the reference. 2. Use the concatenation operator to build the reference path dynamically. For example, if x is your variable and row.pollId is the ID you want to reference, your expression should look something like this:
"_ref:" + x.row.pollId
"_ref:" + x.row.pollId
Make sure that x.row.pollId is correctly fetching the value you need. If the issue persists, verify that row.pollId is defined and accessible in your context. If you still encounter errors, please submit your query via the in-app support button for more detailed assistance. For more information, you can refer to the BuildShip documentation on handling references: BuildShip Documentation.
Luis
Luis6mo ago
I see. Can you open an in-app support ticket so I can further help?
Ryan A
Ryan AOP6mo ago
Thanks @Luis - I have opened a ticket. Thank you.
AI Support
AI Support6mo ago
For ticket-related inquiries, please submit your request via the in-app support button. Our support team will assist you promptly. Thank you!
Ryan A
Ryan AOP6mo ago
@Luis - I submitted support request a few days ago, but heard nothing back. Can you please confirm received. Thank you.
AI Support
AI Support6mo ago
To get assistance with your BuildShip question, please submit your query via the in-app support button. This will ensure that your request is properly logged and addressed by the support team. Thank you.
Luis
Luis6mo ago
Hey @Ryan A, sorry about not updating you. Yes I have access to you workflow and know what the issue is, or I should say it's not so much an issue but more of how the current rowy trigger handles document references. Here's what I mean: the rowy trigger on tables that contains references, but when the changes arrive on the BuildShip side the references are now in a structured object format i.e:
{
"option2": true,
"pollId": {
"_converter": {},
"_firestore": {
"projectId": "osdsdsdsdsd"
},
"_path": {
"segments": [
"poll",
"adsadsadasdasdsadsadasd"
]
}
},
"option4": true
}
{
"option2": true,
"pollId": {
"_converter": {},
"_firestore": {
"projectId": "osdsdsdsdsd"
},
"_path": {
"segments": [
"poll",
"adsadsadasdasdsadsadasd"
]
}
},
"option4": true
}
So now if the you want to filter by pollId then you need to drill all the way into the segments array to get the ref id whereas you would think to just do (x)Row.pollId but that won't work in this case.
AI Support
AI Support6mo ago
It seems like you're dealing with how document references are structured in BuildShip when using Rowy triggers. The references are nested within objects, and you need to drill down into the segments array to get the reference ID. For more detailed information on how to handle document references and triggers in BuildShip, please refer to the following documentation: - Triggers - Document References If you have further questions or need more specific guidance, please submit your query via the in-app support button.
BuildShip - Visual backend workflow builder
Visually build workflows and powerful backend logic for your apps. Powered by AI, connect to anything with or without code.
BuildShip - Visual backend workflow builder
Visually build workflows and powerful backend logic for your apps. Powered by AI, connect to anything with or without code.
Luis
Luis6mo ago
I just wanted to give you some insights as to why it's not working and I'm currently working on a workaround on this and will share with you once ready.
AI Support
AI Support6mo ago
It seems like you're encountering an issue with your BuildShip workflow. For specific guidance and support, please submit your query via the in-app support button. The BuildShip support team will provide you with detailed assistance. If you need general information on how to use BuildShip, you can explore the BuildShip Documentation.
Ryan A
Ryan AOP6mo ago
Thanks @Luis - I look forward to further details regards workaround.
Solution
Luis
Luis6mo ago
@Ryan A, can you give this workflow a try. As a temporary workaround I added a utility node at the top of your workflow for extracting document references from the Rowy row. However, I'm not too sure what you're trying to update in the "Update Document" node, so that may still be off.
AI Support
AI Support6mo ago
Please submit your query via the in-app support button for further assistance.
Ryan A
Ryan AOP6mo ago
Thanks @Luis. How do I add your code (above) as a node?
AI Support
AI Support6mo ago
To add code as a node in BuildShip, you can follow these general steps: 1. Navigate to the Node Explorer: Open your BuildShip project and go to the Node Explorer. 2. Create a Custom Node: - Click on "Create New Node" or a similar option to start creating a custom node. - Provide a name and description for your node. 3. Add Your Code: - In the code editor provided, add the code you want to use in your custom node. - Ensure that your code is correctly formatted and follows the required syntax for BuildShip nodes. 4. Save and Test: - Save your custom node. - Add it to your workflow and test it to ensure it works as expected. For more detailed steps and examples, please refer to the BuildShip Custom Nodes Documentation. If you encounter any issues or need further assistance, please submit your query via the in-app support button.
Luis
Luis6mo ago
Copy & Paste – BuildShip
A unified resource to start building your backend with low-code. Dive into triggers, nodes, and step-by-step guidance to jumpstart your workflow creation.

Did you find this page helpful?