Limit users to own data while Admin can view all data from the same view/app

Hi,

I have a simple IT Ticketing system App. I have created a slice named “Ticket Status”. It is displayed by a Primary View named “All Tickets”. I used [Email] = USEREMAIL() under slice, row filter condition and each user can only view their own tickets. That is great BUT as an Admin myself, I was only able to see the test tickets that I submitted. As an Admin, I want to be able to see all the tickets.

What I want to achieve - From the same App, same views, filter the views only for users but Admin is able to view all data.

What expression should I use in order to achieve that? Any help is appreciated!
Oh and I’m very new to AppSheet so kindly keep in simple :slightly_smiling_face:

OR(
 [email] = USEREMAIL(),
 USERROLE() = "Admin"
)
5 Likes

Hi @TeeSee1 ,

Thanks for your prompt reply. I tried that expression but it didn’t work for me. When I preview as a user I was able to see all the tickets.

Does you tickets table have [email] column?

What does an expression USERROLE() give you when you tested the app with the ‘user’?

You should ‘debug’ each part of an expression to see for yourself what goes on within an expression and adjust accordingly.

If you do further analysis and share the results, community members have a better chance of helping you further.

1 Like

@TeeSee1 Your Expression is correct, I have marked your answer as solution, thanks!
Your words got me thinking and true enough, by only running USERROLE(), the “user” was able to access everything as well.
In fact, the app has not been deployed and I thought the Preview function will show accordingly.
It turns out once I shared the App with the “user” and assign user role, all that’s left is the “user” own tickets.

1 Like

@vincent_tay hey I want too create a similar application where the user can fill up a form to raise a ticket and the admin assigns the tickets to employees. I am unable to find any resources that can guide me for building this application. Also, I am completely new to Google AppSheets. Sorry, I am reposting this.