When a table action is clicked, how to access which table row was clicked on?

I have a table with a single action defined, which triggers a REST API query. In that query, in order to build the URL, I need to get some of the fields from the object displayed in the row that the user clicked on (e.g., to send a DELETE I need to build a URL that has the object id to operate on). The query has access to a triggeredById variable that points to the whole table, and the docs mention a variable "i" to get the row index, but that "i" is always zero for me no matter which row I touch.

Thanks in advance for any help.

Hi there, you can access currentRow or currentSourceRow within row actions to access the fields necessary to trigger your query. More information about row actions can be found in this thread. Hope this helps!

Great, thanks for the nice clear answer, that seems to all work. Seems like a big hole though for this to be so hard to use - and I didn't see any help for this on the docs of the new actions feature, in either the Guides or Reference.
trey

Thanks for the feedback Trey! Definitely agree that this could be more discoverable -- I'll make a note and pass the feedback to the team.

Hi, I can't seem to access the table's currentRow or currentSourceRow in either a Javascript query, or as a module input.

Edit: I see that you can only access it from the "Run script" row actions. If currentSourceRow is not available outside of this context, how can I pass this row to a module running in a modal?

Edit: Solved by creating a variable, then setting that variable from my "Run script" then referencing that variable in my module input. Not intuitive initially but certainly doable now that I know about it.
image
image

1 Like