4 Replies Latest reply on Nov 19, 2015 5:09 AM by Tormod Haugene

    Saving and restoring current view state through javascript API

    Tormod Haugene



      The problem:


      How can I store - and then later retrieve - the custom state of a Tableau view through the javascript-API?




      I am working on a site where we currently allow any user to collaborate a set of Tableau views into a PowerPoint-like online presentation for later use. In our current implementation, the state of Tableau graphs are not stored, and the user therefore has to apply his or hers desired filter, select worksheets etc. while holding the presentation - every time. This is what we now would like to avoid.

      The easiest solution for this would be to simply store and retrieve one of the "Share"-links accessed through the bottom bar interface; these links contains the state of the current view, but so far, we have not been able to do this: firstly, due to domain issues, we cannot simply fetch the Share-links from the embed-code iframe; and secondly, the API-method workbook.getUrl() does not seem to include the state of the current view.

      Then I noticed the workbook.rememberCustomViewAsync(name) and workbook.showCustomViewAsync(name) methods, which seem like a possible solution. However, I cannot seem to get any sensible results from either of these two methods, as they both end up giving obscure, non-informative 500 errors when run.


      An example file, and the errors:


      To better illustrate this issue, I have attached a very simple demo (code attached as a .txt file below) that attempts to use the second method described above. When opened in Google Chrome, the 'remember state'-button gives the following error that can be seen in the Developer Tools (the http response message and developer console output, respectively):


      Http response:


      2015-11-11 16&#x3a;14&#x3a;17.916


      Console error:

      POST http://public.tableau.com/vizql/w/Book6_426/v/YRKE/save_customized_view/sessions/208A699D34E14708A2268AA10A827C99-0:0 500 (Internal Server Error)


      Does anyone know how I can solve this issue, either by making the provided example code work (the second method described), or through any other means? Any help would be appreciated!




      Tormod Haugene