How to programmatically set urlparams.myValue

I would like to be able to set my urlparams.myValue from a js query.

urlparams.myValue = 'Hello World!' seems to have no effect.

urlparams.myValue.setValue() is not a function.

My use case is I pass an invoiceId to an app to filter (on the server) that invoices in tblInvoices. But I need to remove the invoiceId urlparam to I can properly reset the filter.

Hi Bradly! You can set a URL parameter to a JS expression ( {{ ... }}) in the URL Parameters modal, accessed via the "..." menu in the header. It looks like we don't currently have an API for setting a param in a JS query, but you can use temporary state as a workaround:

  1. Click "Create new" under "Temporary state" in the left panel to create a new variable
  2. Set a URL parameter to the temporary state in "URL parameters" modal ({{ exampleState.value }})
  3. Set the temporary state value in your JS query (exampleState.setValue(...))

Getting a response from the system itself - I am honored! :grin:

Got it working, but its a bit finicky as to exactly how to configure it. First let me note that I changed passing query params to passing hash - I will make another post asking for clarifications there.

I am passing in the hash param from another app so my URL is something like:

https://myaccount.retool.com/editor/AccountingPagev2#invoice_id=210703MARC-1

Set a temp var:

image

Then set that to your URLParams. You need to set up a two way connection so fill out both sections:

Then you can read the value either using invoice_id.value or urlparams.hash.invoice_id. You set the value using invoice_id.setValue().

Hi Bradly! Yes, you want to be using the hash value as opposed to the query params. It looks like you've configured it roughly correctly.

Once you get around to posting some of your clarifying questions I'd be happy to take a second look!