Leverage User Attribute Functions (UAF) with Tableau Lightning Web Components

You can leverage User Attribute Functions (UAF) with your Tableau View and Pulse Lightning web components (LWC) to surface specific data based on the attributes of the user looking at a visualization. User attribute functions provide row-level security so that people viewing your visualization only see data relevant to them. For more information about UAFs, see Unlock the Power of Personalized Analytics with User Attribute Functions.

Prerequisites

Tableau UAF Claims Definitions in Salesforce

Tableau UAF claim definitions allow you to include claims for user attributes in the JWT. The values for these attributes can be pulled from Account, User, Opportunity, or Case objects in Salesforce. When used in conjunction with user attribute functions in Tableau content, only data matching the specified attributes is displayed.

For example, a Tableau dashboard may be configured to only show sales data where the value in its [State/Province] data column matches one of the values in the JWT claim for the attribute 'state'.

Syntax: USERATTRIBUTEINCLUDES('attribute_name', expected value)

Example: USERATTRIBUTEINCLUDES('state', [State/Province])

Creating a claim definition in Salesforce can include the appropriate user-specific information in the JWT. In this example, the attribute 'state' may be populated with values from Accounts where the current user is the Account Owner by pulling values from the Billing State/Province field.

Example Claim Definition

  • Definition Name: state_Account_BillingState

  • Attribute Name: state

  • Target Object: Account

  • Target Object Field: Billing State/Province

  • Viewer Target Object Relationship: Current Viewer is the Account Owner

In the case of a sales representative who owns accounts in Washington, Oregon, and California, the JWT will include a claim for 'state' with the values [WA, OR, CA]. The Tableau dashboard would then only show data with [State/Province] values matching WA, OR, or CA.

Create a definition

To create a user attribute definition, follow these steps:

  1. From your Salesforce app, select the gear in the top-right corner, and then select Setup.

  2. On the left navigation pane, enter “Tableau” in the Quick Find search bar.

  3. Select the Tableau UAF Claims Definition settings page.

  4. Select Create New.

  5. Fill in the definition values:

    1. Definition Name: Enter a unique name. (Example: state_Account_BillingState)

    2. Attribute Name: Enter the attribute name specified by the user attribute function in Tableau. (Example: state)

    3. Target Object: Select the target object from which you want to pull the values. Tableau LWCs currently support the User and Account objects.

    4. Target Object Field: Select the field on the target object from which you want to pull the values. (Example: Billing State/Province)

    5. Viewer Target Object Relationship: Select the relationship between the current viewer and the Target Object. (Example: Current Viewer is the Account Owner).

  6. Select Save. Or, if you want to return to the Tableau UAF Claims Definition settings page without saving, select Cancel.

Add a definition to a Tableau Lightning web component page

Home, App, and Record Lightning pages

To add a definition:

  1. Select Select….

  2. Use the arrows to move available definitions to the Selected field.

  3. Select OK.

  4. Repeat for all Tableau Lightning web components on the same page. For more information, see Considerations for multiple components on the same page.

Experience Cloud pages and the Utility Bar

Enter a comma-separated list of UAF claim definition names. To copy definition names, from the Salesforce app, navigate to the Tableau UAF Claims Definition setup page, and select Copy.

Considerations for multiple components on the same page

If multiple Tableau View or Tableau Pulse Lightning web components are added to the same page, each component must have the same set of UAF Definition Names. Only one of the components authenticates to Tableau, and that session will be used to load both components. This means that the relevant user attribute information for both components must be present in that session, no matter which component does the authentication.

For example:

  • If you have two Tableau View components and one needs user attribute information from Definition A and the other needs the user attribute information from Definition B, both components must include both Definitions A and B.

  • If a Tableau View component needs Definition A but the Tableau Pulse component on the same page doesn’t need any user attribute information, both components must include Definition A.

Delete a definition

To delete a user attribute definition, follow these steps:

  1. From your Salesforce app, select the gear in the top-right corner, and then select Setup.

  2. On the left navigation pane, enter “Tableau” in the Quick Find search bar.

  3. Select the Tableau UAF Claims Definition settings page.

  4. Select Delete for the definition that you want to delete.

Home, App, and Record Lightning pages

If you delete a definition that is already added to a Tableau LWC, refresh the page in Lightning App Builder to update the available definitions. Deleted definitions are automatically removed.

Experience Cloud pages and the Utility Bar

Deleted definitions are not automatically removed from the Tableau LWC component field. Deleted definitions in the UAF Definition Names component field won’t cause problems, but do create unnecessary and confusing clutter. To remove definitions from the Tableau LWC component field, select the UAF Definition Names field, and manually delete any names that are no longer in use.

Thanks for your feedback!Your feedback has been successfully submitted. Thank you!