GitHub user dosubot[bot] added a comment to the discussion: Jinja Template - url_param not working
<!-- Greeting --> Hi @j7282978-ops! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> The most common reason `url_param('survey_id')` defaults to 3 in embedded dashboards is a breakdown in passing `urlParams` from the SDK to the backend. Superset expects these parameters in the `url_params` key of the form data, and the Jinja macro will use the default if it can't find the value in the request context or form data. Your feature flag placement looks correct—`ENABLE_TEMPLATE_PROCESSING` must be inside `FEATURE_FLAGS` for Jinja macros to work as expected in Superset 6.x [source](https://github.com/apache/superset/issues/35262). Make sure your embedding setup propagates `urlParams` correctly. The SDK usage should look like: ```js embedDashboard({ id: DASHBOARD_ID, supersetDomain: "http://localhost:8088", mountPoint: document.getElementById("dashboard-container"), dashboardUiConfig: { urlParams: { survey_id: 6 }, // other config... } }); ``` If you’re still seeing the default value, check for CORS/session issues, RBAC permissions for the embedded user, and confirm that the backend receives the expected `url_params` in the form data. Also, be aware of a known bug with async queries and multiple Jinja parameters in embedded dashboards—if you use more than one parameter, cache key mismatches can cause filtering to break [source](https://github.com/apache/superset/issues/34543#issuecomment-3153246318). For dynamic filtering, you can also use the `filter_values()` Jinja function in your SQL query: ```sql SELECT * FROM table WHERE id IN {{ filter_values('survey_id') | where_in }} ``` This approach is often more robust for dashboard filters [source](https://github.com/apache/superset/issues/33387). If you need a working example, the SDK and backend should pass `urlParams` as key-value pairs, and your Jinja query should reference them as shown above. If you’re still stuck, double-check the network requests to ensure `survey_id` is present in the payload sent to Superset. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/878544ef-04bc-4261-8332-c7afd16aef8b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/878544ef-04bc-4261-8332-c7afd16aef8b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/878544ef-04bc-4261-8332-c7afd16aef8b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/878544ef-04bc-4261-8332-c7afd16aef8b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/878544ef-04bc-4261-8332-c7afd16aef8b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/878544ef-04bc-4261-8332-c7afd16aef8b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/878544ef-04bc-4261-8332-c7afd16aef8b?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)& nbsp;[](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/35480) GitHub link: https://github.com/apache/superset/discussions/35480#discussioncomment-14583797 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
