Return query metadata/parameters from within the same query

Context: Our new app runs a couple of Javascript queries that I realized only recently are not included in Retool audit logs. Sometimes our end users have JS queries throwing errors on their end that are difficult to debug, so I am planning on implementing an audit log for Javascript query runs.

Just like in audit logs, I would like to log the query's metadata and the parameters passed. From my understanding, these are only accessible via the Promise returned from trigger() calls. This should be easy to do for queries triggered inside another Javascript query, but what about for queries that are triggered via a button click event handler?

Is it possible for a query to return a Promise or an object containing its metadata, triggeredById, and the parameters/additional scope passed to it, at the end of its run?

Any suggestions on implementing this custom audit log also greatly appreciated!

what an odd coincident, just earlier this week i was playing around with trying out moesif.com for this. I can't get the server side stuff to work since it requires adding npm modules but the client side has an api that can be used to log different things.

to answer your question though, in an on success event you have access to {{ self }} which I think contains the data you're looking for

1 Like