Don’t Take NULL for an Answer – Make Tableau’s ‘getWorkbook()’ and ‘getActiveSheet()’ Functions Behave Correctly

Data

Don’t Take NULL for an Answer – Make Tableau’s ‘getWorkbook()’ and ‘getActiveSheet()’ Functions Behave Correctly

NULL errors have cropped up twice in recent development projects utilizing Tableau’s JavaScript API. In one instance, getWorkbook() returned this error:

SCRIPT5007: Unable to get value of the property 'get__workbook': object is null or undefined

In another instance, getActiveSheet() returned this error:

Uncaught Error: Internal error. Please contact Tableau support with the following information: Unknown sheetType ‘undefined’

Both times, the errors seemingly appeared all of a sudden and for no obvious reason. What changed?

Tableau has been hard at work, updating and upgrading the JavaScript API that they provide. Developers use this API to embed Tableau visualizations/graphs into a variety of web applications and frameworks. Recently, I’ve ran across two instances where Tableau’s updates have had the unfortunate side-effect of breaking a client’s site.

Case #1: Using an Older Tableau Workbook with a Newer Version of the API Script

The first time I ran across this problem, my client was on the cusp of releasing a new version of their website. The project team consisted of several developers, and we had been furiously testing our code from all angles to prepare for the launch. Seemingly overnight, everything that depended on Tableau’s API script stopped working. No matter how much of our custom code we stripped out, the same error was occurring. Every time, the error was generated when we tried to use the ‘getActiveSheet()’ function:

Uncaught Error: Internal error. Please contact Tableau support with the following information: Unknown sheetType ‘undefined’

We finally swallowed our pride and opened a support ticket with Tableau. After they had a chance to review our code, they responded with the following:

The reason that the application is not working is that the JavaScript API being used is actually the API for Tableau Public, which was upgraded to 8.2 recently. Tableau Online is still 8.1, so that is the API that should be used so the versions match.

Changing this—

%MINIFYHTML109a68036e12e1bacfb4daba15c189dd18%

—to this—

%MINIFYHTML109a68036e12e1bacfb4daba15c189dd19%

—should resolve the issue.

As soon as we updated the script reference, everything started working again.

Case #2: Using a Newer Tableau Workbook with an Older Version of the API Script

Another client reported a problem recently that involved a completely different error message, but the circumstances were incredibly familiar. Seemingly overnight, all JavaScript that depended on the Tableau API script stopped working. In this instance, it appeared to be the ‘getWorkbook()’ function, which was returning the following error:

SCRIPT5007: Unable to get value of the property 'get__workbook': object is null or undefined
tableau-api.js, line 2796 character 9

Most clients that use Tableau’s API script reference it directly from Tableau’s servers. But in this instance, the client had downloaded the script to their server in order to prevent security errors inside their corporate firewall. I suggested grabbing the latest version of the script file from Tableau, and the problem resolved itself immediately. 

Conclusion: Don’t Beat Yourself Up

Things are always in flux. It’s the nature of web development. In both instances above, developers spent countless hours trying to debug their custom code. In the end, it was simply a version mismatch between the Tableau workbook and the Tableau JavaScript API. If you’re a developer using this API, and everything suddenly seems to break, my advice is to start by scrutinizing the version of Tableau’s script that you’re using.

More About the Author

Matt Mueggenborg

Lead Web Developer
Don’t Take NULL for an Answer – Make Tableau’s ‘getWorkbook()’ and ‘getActiveSheet()’ Functions Behave Correctly NULL errors have cropped up twice in recent development projects utilizing Tableau’s JavaScript API. In one instance, getWorkbook() ...
The BURNING Question: What was HOT at DrupalCon 2013? As a web developer, you were faced with a unique decision this year. Should you get your ultimate geek on at the 2013 DrupalCon in ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072