Forum Discussion

Haleem's avatar
Haleem
Helper III
7 years ago
Solved

Dynamic RLS with UserName()/email and multiple Cost Center Responsible

I have managed to assign user access to the cost center report based on cost center responsible's email automatically using UserName() function. I maintain cost center responsible table [table name i...
  • adambhappy's avatar
    7 years ago

    Solution 1:
    Unpivot the table with cost center and responsible so it will be one line per the combination of cost center+responsible (regardless of level).

     

    Since it won't like the many-to-many relationship, keep the current table and add the unpivoted table as a new table and keep the current table as bridge table to maintain the one-to-many relationship. Don't forget to tick the box apply security filter in both directions.

     

    Solution 2:
    Change the RLS formula to include a OR statement

    [Cost Center Responsible] =  UserName() || [Country Responsible] = UserName() || RegionalResponsible = UserName() || GroupResponsible = UserName() 

     

  • Haleem's avatar
    Haleem
    7 years ago

    Hi Adam, Thanks a lot for a quick and specific response to my problem.

     

    I liked solution 1 and have created unpivot table and use the existing table as a bridge between unpivot table and data table as shown in the picture. The problem is that I cannot apply "security filter in both directions" it's inactive, and this might be the reason that I cannot restrict the access.

     

  • Haleem's avatar
    Haleem
    7 years ago

    Please ignore my message above. I have fixed the problem. In order to have the option active for Security Filter in both Direction, i have to first select the "Both" option in the Cross Filter Direction as shown in the below screen shot.