136
Views
3
Comments
Solved
Filter aggregate based on role
Service Studio Version
11.53.34 (Build 61795)

Hello,

For my application, I have a project savings table and for each project savings/datapoint, it has its own Business Code (e.g. ABC/DEF/GHI/etc...). So I would like for there to be a role for the user to be able:

To view all project savings/datapoint with the Business code of "ABC" only for example.  Basically allowing the user to view the data based on a attribute. So I have this filters for the aggregate:


1) CheckAdministratorRole(UserId:) = True or CheckABCManagerRole(UserId:) = True or ProjectSavings.UserId = GetUserId() 

2) If(CheckABCManagerRole(UserId:) = True,BusinessUnits.Label = "ABC",BusinessUnits.Label like "%" + SearchText5 + "%")   


This seems to be partially working as the ABCManager can only see those data with ABC Business Code, however, the users with the admin role can only see the same data as the ABCManager instead of being able to view every data. Is there a solution to this or better yet a more elegant solution to my issue? Thank you!


2020-11-25 10-45-32
Mostafa Othman
Champion
Solution

Hello,

If you are using these two lines you mentioned as two filters so when aggregate executed it will apply and between two filters (condition) so everyone will see only projects with BusinessUnits.Label = "ABC" 

1) CheckAdministratorRole(UserId:) = True or (CheckABCManagerRole(UserId:) = True and BusinessUnits.Label = "ABC"  ) or ProjectSavings.UserId = GetUserId() 

You will need to arrange your filters again by combining two lines of filters into one line using or/ and. you can try following filter 


Otherwise you can use fetch data action and use inside it if condition based on user role you will have two branches one for admin which is aggregate will display all projects without filter BusinessUnits.Label = "ABC"  and another branch for ABC manager which has aggregate with filter BusinessUnits.Label = "ABC" 

UserImage.jpg
Low Nico

Hello,

Thank you so much for your help! The filter worked great! I am interested in testing/trying out the data action method too. Thank you for that suggestion! I appreciate it!

2020-11-25 10-45-32
Mostafa Othman
Champion
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.