Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products.
All content is subject to change and is provided without warranty.
Skip to main content Skip to complementary content

GetUserAttr - script and chart function

The GetUserAttr() function returns the following information for the user accessing an app:

  • The email address of the user.

  • The subject of the user.

  • The identity provider (IdP) groups to which the user belongs.

Use the GetUserAttr() function directly in the load script or in a chart expression. In either case, you can use the function to store attributes in a variable, or directly without a variable. If you use this function in Qlik Sense Client-Managed, it returns only empty data values. Therefore, you can use the function to develop scripts in Qlik Sense Client-Managed without encountering errors, with the intention of later uploading the apps to Qlik Cloud.

Syntax:  

GetUserAttr(name)

Return data type: dual

Arguments
Argument Description
name The name of the attribute to return. Enter as a string value in the expression. The string value entered is case-sensitive.

Use the function to load user attributes into your app. The function can return the following attributes:

User attributes that can be returned by the GetUserAttr() function
Attribute Description Example of load script variable Example of chart expression (no variable) Example of chart expression results
userEmail The email of the current user. Let vUserEmail = GetUserAttr('userEmail') =GetUserAttr('userEmail') john.doe@company.com
userSubject The subject of the current user. Let vUserSubject = GetUserAttr('userSubject') =GetUserAttr('userSubject') 00uss7ra3dk9doJln0x7
userGroups The IdP groups of the current user accessing the app. Returns a comma-separated list in a string. Let vUserGroups = GetUserAttr('userGroups') =GetUserAttr('userGroups') Sales,Product-Lead,OKTA-Github-RnD

When to use it

This function returns user properties and groups for the current user of the app. This allows you to build solutions that customize the content that appears for your users. For example, in a global sales application, you can show product-specific sheets to only those sales representatives who are responsible for a particular product group. Use the function in load statements in the app's load script or in chart expressions, either directly as an expression or in an expression stored as a variable.

Example – Storing user attributes as variables in the script

Example – Storing user attributes as variables and using them in chart expressions

Example – Using the GetUserAttr function in the load script

Example – Using the GetUserAttr function in chart expressions

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!