Pass data with "On Success Trigger"

So I love the ability to be able to pass the results of one query into another – for example, after an insert, we can take the last inserted ID and display it on the UI without having to re-query the data. Right now, in order to do this, we seem to have to use a JS Code query that manually defines the onSuccess parameter of query.trigger() as a function (data) => {/*do something with result here*/}, effectively requiring any queries we want to run like this to be wrapped in a Javascript query.

Of course, I see there’s a parameter in the SQL query builder that allows one to specify a query to “On success trigger” – the only problem is, it doesn’t seem to pass any data to the following function. I’ve tried defining the success query as a function (data) => {}, as well as just accessing the “data” variable (tells me it’s not defined). Am I missing something? Is there a better way to do this without wrapping our SQL queries in a JS Code query?

Hey @CKunhardt. You can reference any queries results through {{ }} - if you’re using a JS query, you can trigger the query with query.trigger() and then use in the on success trigger. If you want to avoid using a JS function to organize all of this, you can always reference a query’s results using {{ }} but behavior may vary based on how it’s triggered.