2 Replies Latest reply on Apr 27, 2018 9:58 AM by Sachin Thigale

    Create button/action to save custom views

    Sachin Thigale

      Hello Tableau Community,

       

      I am trying to create a button/action on my dashboard which will save the view as my own view.

      Currently Tableau provides the button as 'View:Original' where we can save our own view but the button is so small and is not visible. On top of it we are embedding our dashboards in another application where this button becomes even smaller.

      So most of the times 'View:Original' is not visible to users or user do not even bother to click on it.

      We have lot of users and every user cannot be trained.

      So dashboard needs to be intuitive. Hence I am looking for creating a button on my dashboard which will save view as my own view whenever I click on it.

       

      Has anyone implemented such solution? Any help would be greatly appreciated.

       

      Thanks

      Sachin

        • 1. Re: Create button/action to save custom views
          Santiago Sanchez

          Hey Sachin,

           

          You can do this with some JavaScript API magic. The HTML page and Workbook attached should give everyone a working example. Custom Views require Tableau Server or Online.

           

          You'll want to replace the <YourTableauServer> tags with the IP or DNS Name of your Tableau Server. You'll also want to publish the workbook on your Tableau Server. Once done, you'll be able to click on the 'Save My View' button:

           

           

          You can learn more about the concepts used on the example on the JavaScript API Tutorial and the API Reference.

           

          There are a few key functions you can see on the code:

           

          1. initializeViz(): Creates and loads the dashboard in the HTML page.

          2. listenToMarksSelection(): Adds an event listener to the dashboard, waiting for a user to interact with the viz.

          3. onMarksSelection(marksEvent): Once a user clicks on a mark, check that the action came from the 'Save my View' button.

          4. saveCustomView(): This saves the custom view for the user on Tableau Server.

          5. saveAsDefault(view): Optionally, this sets the customer view as default.

           

          That shoudl do it! Hope that helps!

          Santiago

          • 2. Re: Create button/action to save custom views
            Sachin Thigale

            Thank you Santiago. Solution works perfectly fine.