Submit after navigating / on load

We have several retool apps, some of which are linked together using utils.openApp.

This is working well, except that I can’t figure out how to trigger the running of a query on load. The value is filled in by setting the default to {{ urlparams.key }}, but once the app is loaded it still requires to select the input field, and pressing enter to run the query.

The target app has several fields for input, each of which can trigger their own query, so I only want to trigger one for the field that is “filled in” via the url parameter.

Approaches I tried:

  • Configuring URL parameters (Customize app URLs | Retool Docs), this does not submit
  • Running JavaScript on load, trying to call fieldName.submit() when the query parameter is set, this does not work, there is no submit() function available.
  • Adding a hidden field (instant) that would be set via URL parameters, and when set instantly triggers the query. This does not work, it’s not possible to specify which inputs need to change or make “Run query when inputs change” conditional.
  • “Run this query on page load”. This is the closest I could get, but does not work well because there are multiple possible fields that could trigger a query for a single result table, so I can’t run them all at the same time, and there is no way to make it conditional.

Note it is not really an option to set the query to run on change, this is a heavy query that should not be triggered while entering data in the field, only on enter.

I'm not understanding this part. Each of these possible inputs is backed by a separate query? In that case wouldn't this prevent the irrelevant queries from running?

Thank you! It seems that might work, but the fields can also be entered just from input, so I suppose I need to set up keeping that in sync too?

1 Like

{{!inputComponent.value && !urlparams.key}} would require both the component and the URL param to be null for the query to be disabled. Once a value is selected for the input the query would be enabled. If multiple inputs can trigger then just add them into the list.