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?
Solution:Jump to 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.
20 Replies
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.
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.
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.
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?
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:
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.I see. Can you open an in-app support ticket so I can further help?
Thanks @Luis - I have opened a ticket. Thank you.
For ticket-related inquiries, please submit your request via the in-app support button. Our support team will assist you promptly. Thank you!
@Luis - I submitted support request a few days ago, but heard nothing back. Can you please confirm received. Thank you.
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.
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:
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.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.
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.
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.
Thanks @Luis - I look forward to further details regards workaround.
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.
Please submit your query via the in-app support button for further assistance.
Thanks @Luis. How do I add your code (above) as a node?
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.
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.