Category: How do I do X?

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How do I make references generic in queries/JS?


I have a problem where I need to update a row in my API using two different structures that have identically named elements. One structure is a modal and the other is a form. I want to be able to reference the widget that called the query generically, so I don't have to write two separate queries. Also, I want to know how to add an additional item to the update row object without having to write out each field, and without relying on a hidden field.


The user had a query to update a row in a sheet through an API query. They had a form in one part of the app and a modal in another, both of which updated the same row using identically named elements. They wanted to write a single query that would reference the widget that called the query and update the row accordingly.

One solution was to pass the field values as parameters to the query using the syntax {{this.params}}. Another solution was to use JSON Form widgets instead of normal Form widgets and pass JSONForm1.formData and JSONForm2.formData as arguments to the query. However, the latter solution did not work for this particular instance as the user could not control the layout of the elements.

In the end, the user decided to include a hidden rowIndex text widget inside their form as a workaround. Overall, this allowed them to update the row in their sheet using either the form or the modal without having to write separate queries.