New table actions can't access currentRow when using Run Query

Hi there,

I was trying to use Run Query to pass the ID of the data in the current row to a query. I'd like specifically to delete the current row, and pass that ID to the query.

If we were able to pass parameters when triggering a query, that'd be perfect. But as we can, I'm forced to use Run Query and do something like what is described here.

The problem is that currentRow seems to be out of scope when using Run Query.
This is the content of Run Query

deleteSearch.trigger({
  additionalScope: {
    search_id: currentRow.id
  }
})

In another app, I save the current row ID to a variable and then use that in the action, but it is a PITA and if currentRow was accessible from Run Query or we could pass parameter to queries it would be a much better solution

Two thoughts:

  1. Is it possible that you need to reference the table in the script? I know it seems like it should be self referential, but using table_name.currentRow.id might be the trick here.

  2. You also might want to use selectedRow.id or selectedSourceRow.id instead

table_name.currentRow never exists.

table_name.selectedRow or table_name.selectedSourceRow work, but seems like a bug that in this case works as expected than the expected behavior. In tables where you want single selection it'll work, but if you want to allow multiple selection won't work.

For multiple row selections you can use table_name.selectedSourceRows or table_name.selectedRows

Actually table_name.currentRow can be accessed, but the UI makes it seem like it cannot in table row actions

2 Likes

Hi there! I'm seeing a similar behavior.

currentRow is working for me on Retool Cloud. The linter warns that it isn't defined, but it gets defined once I click the action button.