Query parameters via URL

Hey peeps

I’m creating a set of dashboards for people in my company to have insights into how Customers are using our product.

Our Sales Team would like to have a direct (custom) link from Salesforce Accounts straight to a dashboard in Redash. The dashboard should be filtered to display information about that specific Customer.

I’m hoping I’d be able to pass the Salesforce ID as a parameter to the dashboard via the URL, but can’t find how to. I’ve looked at both the query parameters and query filters documentation but can’t find an example of how to get it done.

What am I missing?

Hi!

Yes, this is possible using query parameters:

  1. Create your queries/visualizations using a parameter that filters the data using the Salesforce ID.
  2. Make sure to use the same parameter name in all queries (i.e. {{salesforce_id}}).
  3. In Parameter Settings make sure to check the “Global” checkbox.

Now when you use these visualizations on a dashboard, it will have a single Salesforce ID parameter that controls all these visualizations.

Assuming the parameter name is salesforce_id as in the example above, to pass the value from the URL, you will add p_salesforce_id=... to the dashboard URL. I.e.: https://app.redash.io/acme/dashboard/customer-view?p_salesforce_id=123.

Let me know if you have any further questions about this.

1 Like

Awesome stuff, mate.

Worked like a charm.

1 Like

Hi guys,

Need some help, when I try to share a dashboard that have parameters receive this message “Sharing is currently not supported for dashboards containing queries with parameters.”. My question is, is this a paid feature or is it not possible at all?

I really like redash, but I need this to work with.

Best Regards,
Lucas.

We don’t have paid features.

This is something that isn’t support yet. It’s being implemented in this Pull Request:

2 Likes

Thanks for the answer, awesome.

Hi everyone,

Thanks for the answers, that works pretty well.

I would need to go even further and have the ability to use the API to export in CSV or JSON the output and still passing my variables into the url.

Is there any way to do that properly ?

Thanks a lot

This isn’t officially supported today for the same reason parameters in public dashboards are not. I think there may be a workaround today using the Redash API to run the query and then pull out its most recent cached result.

Here’s a Javascript example of how to use the API to get the results in JSON format using parameters:

1 Like

Hi to all,
I just show the great new “parameter in public dashboard” feature.
The first question I got back was “is there a way to download the result dataset of each query ?”

Is there a way to do it ? Arik, sorry for the newbie question but how to use the javacsript code you wrote ?

Thanks a lot, for the tool :wink: and for your attention

Only logged-in users can download CSV / Excel results from dashboards. We want to change that in the future.

For now, you can work around the limitation with the API. But you’ll need a scripting environment like Node or Python to do it. In a pinch you can interact with the Redash API from the developer tools in your browser. Or use a REST client like Insomnia. But this is probably too complicated for your users.

You’ll need to install NodeJS to run Arik’s script.

Ok thanks @susodapop ! I’ll wait :grinning:

Hi,

Thanks for this discussion it’s helped me implement a public dashboard with different query parameters in the URL.

I now would like to publish the dashboard & have a public link for each of the different views of the dashboard using different query parameters. In my queries I have a default for the query parameter. When I publish my dashboard I get the public url with the org_slug=default at the end. This means in the published url I can’t change the query parameter, rather it is always statically fixed to the default data.

Can someone advise me: is it possible to get unique public urls when you publish a dashboard that correlate to each query parameter, in the same way that you can with the unpublished dashboard?

Thanks
Charlotte

This feature is under active development. We’ll announce on the forum when it becomes available.