Unable to open the same app with event handler

Goal

I'm trying to reopen the same App with a different URL parameter using a search bar in the navigation bar.

Steps

  1. Add a button to your app
  2. Add an event handler that opens the same app
  3. The app does nothing

Details

I have a search bar with my navigation bar in the header of every page, allowing the user to search for a Customer using the customer ID. This works on every page except the Customer page itself. I want to allow the end user to reopen the same app page with a new URL parameter because I am using it to fetch customer data.

I tried using an open URL event handler instead but there is an app ID(?) which does not work if it is removed to use such a URL format:
my-retool-url.com/Customer?customer_id=123

Screenshots

I suspect your issue here is this doesn't feel like the intended use case for url params. I would recommend setting the search input default value to the value of the URL param, and then run your query based off the search input value.

URL params should be used to link someone to a specific state in your app. You shouldn't use them to store the current state of your app.

That being said, if you want to change the URL params, you dont actually need to reopen the app - just set the URL param to equal the value of your input. Then, as you change the input, the params will change.

Hopefully this makes sense! Let me know if this wasn't what you mean.

1 Like

thanks for the reply!

URL params should be used to link someone to a specific state in your app. You shouldn't use them to store the current state of your app.

not sure I follow you here. I am using the URL param to pass a customer_id to the Customer page which is then used to fetch the customer record from the database. How should the ID be passed to this page for data fetching?

That being said, if you want to change the URL params, you dont actually need to reopen the app - just set the URL param to equal the value of your input. Then, as you change the input, the params will change.

This makes sense, I guess the urlParams could be a watched input and trigger queries when it changes.

Hello @samthing!

Check out our new feature multipage apps! The docs are here, you can read about how to pass values such as Customer IDs across apps to then pass into a query to fetch the relevant data you need!

This will be much easier than using the 'go to app' Action. Although that should work. You can grab the queryParams and or hashParams from urlparams object in the apps state once you change apps. As described in our docs here!