Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
laacib
Contributor III
Contributor III

How to identify user by email address in an expression in Qlik Sense SaaS?

Hi,

I would like to allow users to see only particular filter fields according to their email addresses. Something like this in the expression for the field of a table object:

= if(USER.EMAIL='user1@domain.com', [FIELD1],
    if(USER.EMAIL='user2@domain.com', [FIELD2],
   [DEFAULT_FIELD])) // for other users

 

And in the access section of the load script something like

Section Access;

OMIT_FIELDS:
Load * INLINE [
    ACCESS, USER.EMAIL, OMIT
   USER, user1@domain.com, FIELD2
   USER, user1@domain.com, DEFAULT_FIELD
 
   USER, user2@domain.com, FIELD1
   USER, user2@domain.com, DEFAULT_FIELD
];
 
Does it make sense? Any idea how to implement this? In the table object no entries are displayed for those users for that field. But other users can see the content of the default field as expected. Thanks for any advice!

 

1 Solution

Accepted Solutions
laacib
Contributor III
Contributor III
Author

I haven't found any function that tells the email address of the current user. But instead the ID (IdP) of the current user with

vCurrentUserID='SubField(OSUser(),'=',-1)'

 which can be checked against the IDs of other users. 

I put the IDs/IdP which can be found in QMC -> users (see Screenshot) in variables like:

vUserName1ID='out0|cs...';

vUserName2ID='out0|cs...';

and then in an expression checks against vCurrentUserID with something like

=if( '$(vCurrentUserID)'='$(vUserNameXID)', ..., )

View solution in original post

3 Replies
Chanty4u
MVP
MVP

Try this 

Section Access;

LOAD * INLINE [

    ACCESS, USERID, EMAIL, FIELD_ACCESS

    ADMIN, admin, *, *

    USER, user1, user1@domain.com, FIELD1

    USER, user2, user2@domain.com, FIELD2

];

 

Section Application;

LOAD * INLINE [

    FIELD1, FIELD2, FIELD3

    value1, value2, value3

    value4, value5, value6

];

 

Anil_Babu_Samineni

If a user's login, how the user profile looks like? Is this with email ID that is shown? 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
laacib
Contributor III
Contributor III
Author

I haven't found any function that tells the email address of the current user. But instead the ID (IdP) of the current user with

vCurrentUserID='SubField(OSUser(),'=',-1)'

 which can be checked against the IDs of other users. 

I put the IDs/IdP which can be found in QMC -> users (see Screenshot) in variables like:

vUserName1ID='out0|cs...';

vUserName2ID='out0|cs...';

and then in an expression checks against vCurrentUserID with something like

=if( '$(vCurrentUserID)'='$(vUserNameXID)', ..., )