User can only view the data that they requested
Application Type
Traditional Web

Hi, I am kinda new to Outsystems. 


I have a form and a table data wherein it stores all of the data from requestform, Can you help me on how can I filter the view of the requested data per role?


Thank you!

mvp_badge
MVP
Solution

Hello Sean.

You can start by doing the training. It explains how to do a filter by screen parameters. https://www.outsystems.com/training/courses/114/developing-web-apps-outsystems-11/

Your question is a bit different. A filter by role.

The way I see this you need to call CheckRole functions to know the roles that the user has.

Then on the query you use that information. Example: 

Table.CreatedBy=GetUserId() or CheckAdministratorRole()

Users see their personal answers, but admins see everything.


Is this what you are looking for?

 Hi Nuno,

Thanks for the response and I think that is the thing that I am looking for.

Many thanks! will try it on my end right now 

Hi Nuno, 


I have tried the logic of the query that you have given to me like the user can see their data only but the admin can. However, I'm facing an issue regarding the user's view because the table cant show anything at all even if the data that the user requested has the ID also. Kindly  refer to the attached image below:

This is the query that I made wherein the Sheet1table is the current table list in the screen and the DocAuthor is where I put the userID of the user.

This is the view of the user on the table upon sending a request but the user's request is not showing either.

mvp_badge
MVP

Your logic needs some adjustments. DocAuthor is of type Text. What do you have on that attribute?

It should be User Identifier so it can be compared with the result of GetUserId.

Hi Nuno,


Actually it works! haha apologies I just realized that I am trying it to a text instead of user identifier.


Many thanks Nuno for your help!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.