Hi GoodData Support Team, At a high level, I’d lik...
# gooddata-cloud
k
Hi GoodData Support Team, At a high level, I’d like to confirm the expected behavior when passing a Buyer parameter via the dashboard embed API. If the application provides a Buyer value through the API: Will the dashboard be rendered with that value applied as a filter, similar to how it would behave if a user manually selected the Buyer filter within the dashboard? • In other words, can this be used to pre-fill the buyer filter on initial load? Additionally: • After the dashboard loads with this pre-filled filter, can the user still interact with and modify the filter freely (e.g., change the buyer selection)? From a high-level perspective, is this approach essentially equivalent to setting a default filter state on dashboard load, without restricting further user interaction? If yes how to construct URL from external application. Thanks in advance for your clarification.
k
Great questions! Here's a clear breakdown based on the available GoodData documentation and community knowledge: Pre-filling a Filter on Dashboard Load Yes, you can programmatically set a filter (like a "Buyer" attribute filter) when embedding a dashboard. However, this is not a security feature — it simply pre-selects the filter value on load. As GoodData support has explicitly stated: > "While it is technically possible to pre-select dashboard filters during embedding, this is not a security feature. End users would still be able to change filter values in the UI and access other values present in the filter." [Dynamic Filters via Embed] So to answer your questions directly: • Yes, the dashboard can be rendered with a pre-filled Buyer filter on initial load. • Yes, users can still freely interact with and modify the filter after load. • This is essentially equivalent to setting a default filter state, not a restriction. How to Apply the Filter There are two main approaches depending on how you embed the dashboard: 1. iFrame Embedding — Use setFilterContext PostMessage Send a
setFilterContext
command via
postMessage
after the dashboard loads. This overrides any existing filters with the values you provide. [setFilterContext Command]
Copy code
{
  "gdc": {
    "product": "dashboard",
    "event": {
      "name": "setFilterContext",
      "data": {
        "filters": [
          {
            "positiveAttributeFilter": {
              "displayForm": {
                "identifier": "buyer_id"
              },
              "in": [
                "buyer_value_here"
              ],
              "textFilter": true,
              "selectionMode": "multi"
            },
            "displayAsLabel": {
              "identifier": "buyer_id.buyername"
            }
          }
        ]
      }
    }
  }
}
Replace
buyer_id
with your actual attribute identifier and
buyer_value_here
with the desired value. [Attribute Filters PostMessages] 2. React SDK Embedding — Use Dispatch Commands If you're using the
@gooddata/sdk-ui-dashboard
React component, use
useDispatchDashboardCommand
with
changeAttributeFilterSelection
, listening for the
dashboardInitialized
event before applying the filter. [React Dispatch Commands] Regarding URL-Based Filter Links If you want to generate a shareable URL with filters pre-applied (rather than using the embed API), GoodData does support this via the Share dialog on a dashboard with active filters. However, there is no documented public API to programmatically generate these URLs with encoded filter states — it must be done manually through the dashboard UI. [Link to Dashboard with Active Filters] Important Recommendation If your use case involves multi-tenant data isolation (e.g., each buyer should only see their own data), pre-filling filters is not sufficient. GoodData recommends using Workspace Data Filters (WDFs) or User Data Filters (UDFs) for secure, access-controlled filtering. [Secure Filtering Approaches] 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups. 👀 Our Support team monitors all messages and will jump in if needed.
m
Hi Krishti, we jut wanted to followup with you here and see if you need any further assistance? 🙂