1 Reply Latest reply on Jul 3, 2019 1:13 PM by John Hegele

    Finding parameter from a dashboard

    Aarathi Kandukuri


      There are 5 parameters on my dashboard.

      I want to find one particular parameter from the dashboard in API javascript.


      Using  Tableau.extensions.dashboardContent.dashboard.findParameterAsync("Start Date") is giving me undefined value.


      Thanks in Advance.

        • 1. Re: Finding parameter from a dashboard
          John Hegele

          Hi Aarathi,


          I think I know what's happening here, though some added context around how this fits into your code might be necessary to really get to the bottom of this. But, my guess is that you are doing something like this:


          var param = tableau.extensions.dashboardContent.dashboard.findParameterAsync("Start Date");



          Then, when you check the console, you're seeing undefined.


          If that's the case then the reason you're seeing undefined is that the findParameterAsync method executes asynchronously. This means that findParameterAsync returns a Promise and not the actual parameter. In order to access the parameter returned by the Promise, try this:


          tableau.extensions.dashboardContent.dashboard.findParameterAsync("Start Date").then(function(param) {




          In your console, you should see something that looks like this (once you expand it):


          Screen Shot 2019-07-03 at 4.07.21 PM.png

          Note: this is a param from the Superstore dashboard so yours won't look exactly like this


          Without more code, the only other thing I see is that you're capitalizing Tableau and the window object created by the Extensions API is all lowercase (notice that, in my code, I used "tableau", all lowercase).


          Best of luck!