Calling a retool query from javascript


The following routine is to delete a record, I just want prompt a confirmation “before”. How is the right way to call the retool query called “deleteRow” from javascript?

if (confirm(‘Are you sure you want to delete this record ?’)) {
// Deleted!
console.log(‘Record has been deleted.’);
} else {

// Do nothing!
console.log(‘Canceled by user.’);

HI @josvaler! & Welcome to the community! :sunglasses:

You can trigger a Retool query (and pass in data to it!) using the query.trigger() method. An example of this can be found in the Scripting Retool docs.