Nov 25, 2021
Advanced filtering – Integration, Authentication, and Tableau Viz LWC
For more control over filtering the Tableau visualization on a record page, you can establish a mapping between a Tableau field and a Salesforce field. The Tableau field should be present in the embedded visualization, while the Salesforce field must be a qualified field on the embedding page. The Tableau Lightning Web Component filters the Tableau visualization automatically when these field values match.
To evaluate this filtering, add the Tableau Visualization component to a record page. For example, insert a sales-related Tableau visualization onto your opportunity record pages.
Let us try an example:
- In your Salesforce organization, access the App Launcher, select Sales, and click the Accounts tab, like in the following screenshot:
Figure 7.19: Accounts tab in Sales app
- Choose an account from the All Accounts list, it does not matter which.
- Click the Setup gear and select Edit Page, as shown below.
Figure 7.20: Setup menu on Account page
- Drag the Tableau Visualization component from the Custom area of the Lightning Components list to the right-hand side of the page canvas. That should look as shown in Figure 7.21:
Figure 7.21: Dragging Tableau Visualization to Account page
- Configure the component by entering the Tableau visualization URL containing the desired data. Here you can use: https://public.tableau.com/views/MarketingActivityCalendar/MarketingActivityCalendar?:language=en&:display_count=y&:origin=viz_share_link
- Specify the Tableau field for filtering, which must be a field in the embedded visualization. Here you can type in “City”. Now, indicate the Salesforce field for filtering, which can be chosen from the qualified field names drop-down list, here choose “BillingCity”
- Save the page and return to the account page. The Lightning Web Component now filters the Tableau visualization automatically when the values from the two specified fields match. In the screenshot below, “BillingCity” is set to “Dallas”.
Figure 7.22: Context filtering based on account field
If you need an exceptional level of control of the experience, the Tableau Viz LWC is available on GitHub, https://github.com/tableau/tableau-viz-lwc/ , under an MIT license. This means that you can fork the component and create your own version. This is not advisable under normal circumstances, but it is good to know that it is possible should you experience unique security, performance, or compatibility requirements that cannot be addressed using the standard component.