Integrating Salesforce and Tableau

Tom Leddy
Salesforce Architects
6 min readSep 21, 2020

--

Tableau and Salesforce

Overview

Your users are probably used to building standard Salesforce reports and dashboards to report on data stored in your Salesforce organizations. But for as powerful as standard reports and dashboards are, they’re not without limitations. Any data that appears in a Salesforce report has to be stored in the platform, which prevents you from combining Salesforce data with potentially useful data stored in other systems. Also, certain types of visualizations aren’t possible using standard dashboards (e.g., displaying location data on a map), so your options for presenting your data without a visualization tool are limited as well.

If you need to combine data from multiple systems into a single report or need to create advanced visualizations from your data, an analytics tool like Tableau is a great fit. Tableau enables you to combine data from as many systems as you want and offers a variety of advanced visualization tools to help display it. This lets stakeholders “connect the dots” between data elements that were previously siloed and makes it easy to identify trends that may have been impossible to spot in the past.

This is all great, but what if you’d like to embed a Tableau Viz (dashboard) into your Salesforce user interface so your users can view it without switching to another application every time they want to view a dashboard? The good news is that not only is this possible, but you can also enable single sign-on (SSO) to work across Salesforce and Tableau, and you can also set up deep linking to open Salesforce record pages from a Tableau dashboard.

Finding your dashboard’s Share URL

Every Tableau dashboard has a share URL. This is similar to the URL in your browser’s address bar but it contains some additional security information needed to prevent clickjacking and similar attacks. So regardless of the embedding method you decide to use, you’ll need to use this URL to embed your dashboard. To find it, open the dashboard you want to embed, click the Share button in the top-right corner, and click Copy Link.

Finding the right share link on Tableau

Embedding dashboards with Lightning Web Components

If you’re using Lightning, a simpler approach to embedding Tableau dashboards is to use Lightning Web Components.

For this to work, you’ll need to:

Once you’ve completed these two steps, embedding a dashboard is a drag-and-drop process that works the same way as embedding a standard dashboard on a Lightning page. Simply edit the page that you want to add the dashboard to in Lightning App Builder, drag a Tableau Visualization Component onto it, and set the dashboard’s share URL.

Setting the share URL in Tableau dashboard

A few other settings are available for you to adjust, such as the dashboard height and the visibility of the tabs and toolbar. If you’re embedding your dashboard on a record page, you can also set custom filters to ensure that the dashboard only displays data relevant to the current record.

Setting custom filters in Tableau
Example custom filters in Tableau

Embedding dashboards with Visualforce

The old-school way of embedding is to create a Visualforce page with an iFrame that contains the share URL for the dashboard using a code snippet like this:

<pre>

<apex:page standardController="Account">

<apex:iframe src="TABLEAU_VIZ_SHARE_URL&:toolbar=no"height="XXXpx"width="XXXpx" scrolling="true" />

</apex:page>

</pre>

This method is still supported and there are two scenarios where it would make sense to use it:

  • If you’re still using Salesforce Classic, this is the only supported method of embedding dashboards.
  • If you’d like to include additional coding on the page beyond simply embedding the dashboard. For example, you may want to use custom metadata types to differentiate between test dashboards for display in a Salesforce sandbox and live dashboards for display in your production organization.

Note that if you hard code the height and width into the iFrame tag, the dashboards won’t automatically resize to fit different form factors. As a result, this might not be the best approach if you’re looking to provide an experience optimized for mobile devices.

Authentication

You don’t want your users to log into Salesforce only to find a Tableau login screen where the dashboard is supposed to be. To avoid this, once your dashboards are embedded, you’ll want to set up single sign-on across the two applications. The legacy way of doing this with Tableau Server required several steps to set up trusted authentication between your identity provider, Salesforce, and Tableau. It was always tricky to get this method to work properly and fortunately it’s been deprecated in favor of SAML-based authentication.

SAML is the recommended and supported way to implement single sign-on between Salesforce and Tableau. Setting it up is straightforward and as an added bonus, the process is the same regardless of whether you’re using Tableau Server or Tableau Online.

You’ll need to make sure that you have a user store and an identity provider that supports SAML. You’ll also need to follow the instructions to connect your identity provider to both Salesforce and Tableau, and then ensure that the appropriate users have access to both applications along with whatever dashboards you’d like them to see. The authentication process described below takes place in the background after a user logs into Salesforce. You shouldn’t need to do anything else after the initial SSO configuration, but understanding these steps can be helpful for troubleshooting:

  1. A user navigates to Salesforce and enters their username to log in
  2. Salesforce starts the authentication process and redirects the request to the registered identity provider
  3. The identity provider requests additional credentials from the user and authenticates the user
  4. The identity provider returns a SAML success response to Salesforce
  5. The user navigates to a page that contains a Tableau dashboard
  6. Salesforce shares the SAML success response with Tableau
  7. Tableau verifies that the user is authorized to view the dashboard and displays it
Visualization of Salesforce and Tableau integration

Deep linking

Standard Salesforce reports often include hyperlinks that users can click access record pages directly from the report. If you’re planning to embed a Tableau dashboard into Salesforce, you may want to provide similar functionality. Creating these deep links is a straightforward process and most of the work needed to make it happen is within the design of the Dashboard itself.

When creating a Tableau dashboard, you use a desktop application called Tableau Desktop to design the visualizations. To add a hyperlink that opens a Salesforce record, follow these steps:

  1. Get the ID for the record page you want to open.
  2. Add a URL Action to the dashboard that follows the same format as the URLs that Salesforce uses to display records with the record ID embedded into it (e.g., https://[ORG].lightning.force.com/lightning/r/Account/[ACCOUNTID]/view).
  3. Add a hyperlink with this format to a Tableau dashboard that’s embedded in Salesforce. Users can then navigate to the appropriate record page when clicking the link just like they can with a standard Salesforce report.

Additional resources

About the author

Tom Leddy is a Director of Education Services at Salesforce.org. As a certified Salesforce Architect, he advises education industry customers that are undertaking digital transformation efforts to help reshape their organizations and serve their constituents more effectively. He also leads multiple Salesforce.org community efforts, including the Ask an Architect content series and the Architect Academy Roundtables series. Tom is a published author, public speaker, and marathon runner based in the Chicago area. You can connect with him on LinkedIn, Instagram, and Twitter.

--

--

Tom Leddy
Salesforce Architects

Stories about software architecture, leadership, running and resilience.