Hey Paden, a Retool JS script is not async
, so it won't "wait" when the await
keyword is used when used at the top-level scope.
Instead you can return a Promise and use an event handler for code that should run after the asynchronous calls complete. Event handlers will be called after the Promise resolves.
So your javascript might look like the following:
return Promise.all([edit_part.trigger(), add_part.trigger()]);
And you'd add a Success Event Handler to this query that might look like:
table3.selectNextRow();
You can see more examples in our docs or check out this Community post for a deep dive into how to think about async functions when scripting in Retool.